Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
76c03a2b
Commit
76c03a2b
authored
Sep 11, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Graph] working on moving controls out of the way
parent
0918f47a
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
19 deletions
+33
-19
Graph.css
dist/styles/Graph.css
+3
-0
Graph.sass
dist/styles/Graph.sass
+3
-0
Graph.purs
src/Gargantext/Components/Graph.purs
+2
-2
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+15
-16
Controls.purs
src/Gargantext/Components/GraphExplorer/Controls.purs
+1
-1
Types.purs
src/Gargantext/Hooks/Sigmax/Types.purs
+9
-0
No files found.
dist/styles/Graph.css
View file @
76c03a2b
...
@@ -26,5 +26,8 @@
...
@@ -26,5 +26,8 @@
display
:
inline
;
display
:
inline
;
float
:
left
;
float
:
left
;
}
}
#graph-explorer
#tree
{
position
:
absolute
;
}
/*# sourceMappingURL=Graph.css.map */
/*# sourceMappingURL=Graph.css.map */
dist/styles/Graph.sass
View file @
76c03a2b
...
@@ -26,3 +26,6 @@
...
@@ -26,3 +26,6 @@
ul
ul
display
:
inline
display
:
inline
float
:
left
float
:
left
#tree
position
:
absolute
src/Gargantext/Components/Graph.purs
View file @
76c03a2b
...
@@ -169,8 +169,8 @@ sigmaSettings =
...
@@ -169,8 +169,8 @@ sigmaSettings =
, labelSizeRatio: 2.0 -- label size in ratio of node size
, labelSizeRatio: 2.0 -- label size in ratio of node size
, labelThreshold: 2.0 -- min node cam size to start showing label
, labelThreshold: 2.0 -- min node cam size to start showing label
, maxEdgeSize: 1.0
, maxEdgeSize: 1.0
, maxNodeSize:
3
0.0
, maxNodeSize:
1
0.0
, minEdgeSize:
1.0
-- in fact used in tina as edge size
, minEdgeSize:
0.5
-- in fact used in tina as edge size
, minNodeSize: 5.0
, minNodeSize: 5.0
, mouseEnabled: true
, mouseEnabled: true
, mouseZoomDuration: 150.0
, mouseZoomDuration: 150.0
...
...
src/Gargantext/Components/GraphExplorer.purs
View file @
76c03a2b
...
@@ -14,6 +14,7 @@ import Thermite (Render, Spec, simpleSpec)
...
@@ -14,6 +14,7 @@ import Thermite (Render, Spec, simpleSpec)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as RH
import Reactix.DOM.HTML as RH
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax.Sigma (Sigma)
import Gargantext.Hooks.Sigmax.Sigma (Sigma)
import Gargantext.Hooks.Sigmax.Types as Sigmax
import Gargantext.Hooks.Sigmax.Types as Sigmax
import Gargantext.Components.GraphExplorer.Controls as Controls
import Gargantext.Components.GraphExplorer.Controls as Controls
...
@@ -87,7 +88,7 @@ explorerCpt state = R.hooksComponent "GraphExplorer" cpt
...
@@ -87,7 +88,7 @@ explorerCpt state = R.hooksComponent "GraphExplorer" cpt
]
]
, row [ Controls.controls controls ]
, row [ Controls.controls controls ]
, row [ tree {mCurrentRoute, treeId} controls
, row [ tree {mCurrentRoute, treeId} controls
, mGraph controls {graphId, graph}
, mGraph controls
.sigmaRef
{graphId, graph}
, Sidebar.sidebar controls ]
, Sidebar.sidebar controls ]
, row [ ]
, row [ ]
]
]
...
@@ -102,39 +103,37 @@ explorerCpt state = R.hooksComponent "GraphExplorer" cpt
...
@@ -102,39 +103,37 @@ explorerCpt state = R.hooksComponent "GraphExplorer" cpt
pullLeft = RH.div { className: "pull-left" }
pullLeft = RH.div { className: "pull-left" }
pullRight = RH.div { className: "pull-right" }
pullRight = RH.div { className: "pull-right" }
tree {treeId: Nothing} _ = RH.div {} []
tree {treeId: Nothing} _ = RH.div {
id: "tree"
} []
tree _ {showTree: false /\ _} = RH.div {} []
tree _ {showTree: false /\ _} = RH.div {
id: "tree"
} []
tree {mCurrentRoute, treeId: Just treeId} _ =
tree {mCurrentRoute, treeId: Just treeId} _ =
RH.div { className: "col-md-2" } [ Tree.elTreeview {mCurrentRoute, root: treeId} ]
RH.div { id: "tree", className: "col-md-2" } [
Tree.elTreeview {mCurrentRoute, root: treeId}
]
mGraph :: R
ecord Controls.Controls
-> {graphId :: GraphId, graph :: Maybe Graph.Graph} -> R.Element
mGraph :: R
.Ref (Maybe Sigmax.Sigma)
-> {graphId :: GraphId, graph :: Maybe Graph.Graph} -> R.Element
mGraph _ {graph: Nothing} = RH.div {} []
mGraph _ {graph: Nothing} = RH.div {} []
mGraph
controls {graphId, graph: Just graph} = graphView controls
{graphId, graph}
mGraph
sigmaRef {graphId, graph: Just graph} = graphView sigmaRef
{graphId, graph}
type GraphProps = (
type GraphProps = (
graphId :: GraphId
graphId :: GraphId
, graph :: Graph.Graph
, graph :: Graph.Graph
)
)
graphView :: R
ecord Controls.Controls
-> Record GraphProps -> R.Element
graphView :: R
.Ref (Maybe Sigmax.Sigma)
-> Record GraphProps -> R.Element
graphView
controls props = R.createElement el
props []
graphView
sigmaRef props = R.createElement (R.memo el (==))
props []
where
where
el = R.hooksComponent "GraphView" cpt
el = R.hooksComponent "GraphView" cpt
cpt {graphId, graph} _children = do
cpt {graphId, graph} _children = do
pure $
pure $
RH.div {
className: colSize controls
}
RH.div {
id: "graph-view", className: "col-md-12"
}
[
[
Graph.graph {
Graph.graph {
forceAtlas2Settings: Graph.forceAtlas2Settings
forceAtlas2Settings: Graph.forceAtlas2Settings
, graph
, graph
, sigmaSettings:
Controls.controlsToSigmaSettings control
s
, sigmaSettings:
Graph.sigmaSetting
s
, sigmaRef:
controls.
sigmaRef
, sigmaRef: sigmaRef
}
}
]
]
-- TODO: this doesn't work? seems to always render "col-md-9"
colSize {showSidePanel: (true /\ _), showTree: (true /\ _)} = "col-md-8"
colSize {showSidePanel: (false /\ _), showTree: (false /\ _)} = "col-md-12"
colSize _ = "col-md-10"
convert :: GET.GraphData -> Graph.Graph
convert :: GET.GraphData -> Graph.Graph
convert (GET.GraphData r) = Sigmax.Graph {nodes, edges}
convert (GET.GraphData r) = Sigmax.Graph {nodes, edges}
...
...
src/Gargantext/Components/GraphExplorer/Controls.purs
View file @
76c03a2b
...
@@ -51,7 +51,7 @@ type LocalControls =
...
@@ -51,7 +51,7 @@ type LocalControls =
initialLocalControls :: R.Hooks (Record LocalControls)
initialLocalControls :: R.Hooks (Record LocalControls)
initialLocalControls = do
initialLocalControls = do
edgeSize <- R.useState' $ Range.Closed { min: 0.5, max: 1.0 }
edgeSize <- R.useState' $ Range.Closed { min: 0.5, max: 1.0 }
labelSize <- R.useState'
3
.0
labelSize <- R.useState'
14
.0
nodeSize <- R.useState' $ Range.Closed { min: 5.0, max: 10.0 }
nodeSize <- R.useState' $ Range.Closed { min: 5.0, max: 10.0 }
pauseForceAtlas <- R.useState' true
pauseForceAtlas <- R.useState' true
showEdges <- R.useState' true
showEdges <- R.useState' true
...
...
src/Gargantext/Hooks/Sigmax/Types.purs
View file @
76c03a2b
module Gargantext.Hooks.Sigmax.Types where
module Gargantext.Hooks.Sigmax.Types where
import Gargantext.Prelude
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe)
import Data.Maybe (Maybe)
import Data.Sequence as Seq
import Data.Sequence as Seq
import Data.Sequence (Seq)
import Data.Sequence (Seq)
...
@@ -8,5 +11,11 @@ import DOM.Simple.Types (Element)
...
@@ -8,5 +11,11 @@ import DOM.Simple.Types (Element)
newtype Graph n e = Graph { nodes :: Seq {|n}, edges :: Seq {|e} }
newtype Graph n e = Graph { nodes :: Seq {|n}, edges :: Seq {|e} }
derive instance eqGraph :: Eq Graph
--instance eqGraph :: Eq Graph where
-- eq (Graph {nodes: n1, edges: e1}) (Graph {nodes: n2, edges: e2}) = n1 == n2 && e1 == e2
type Renderer = { "type" :: String, container :: Element }
type Renderer = { "type" :: String, container :: Element }
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment