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
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
gargantext
purescript-gargantext
Commits
c57efdc4
Commit
c57efdc4
authored
Dec 12, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Graph] edge range slider ranges are based on graph data now
parent
749eea82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
29 deletions
+21
-29
Controls.purs
src/Gargantext/Components/GraphExplorer/Controls.purs
+12
-5
RangeControl.purs
src/Gargantext/Components/GraphExplorer/RangeControl.purs
+9
-24
No files found.
src/Gargantext/Components/GraphExplorer/Controls.purs
View file @
c57efdc4
...
...
@@ -114,6 +114,16 @@ controlsCpt = R.hooksComponent "GraphControls" cpt
else
pure unit
let edgesConfluenceSorted = A.sortWith (_.confluence) $ Seq.toUnfoldable $ SigmaxTypes.graphEdges props.graph
let edgeConfluenceMin = maybe 0.0 _.confluence $ A.head edgesConfluenceSorted
let edgeConfluenceMax = maybe 100.0 _.confluence $ A.last edgesConfluenceSorted
let edgeConfluenceRange = Range.Closed { min: edgeConfluenceMin, max: edgeConfluenceMax }
let edgesWeightSorted = A.sortWith (_.weight) $ Seq.toUnfoldable $ SigmaxTypes.graphEdges props.graph
let edgeWeightMin = maybe 0.0 _.weight $ A.head edgesWeightSorted
let edgeWeightMax = maybe 100.0 _.weight $ A.last edgesWeightSorted
let edgeWeightRange = Range.Closed { min: edgeWeightMin, max: edgeWeightMax }
let nodesSorted = A.sortWith (_.size) $ Seq.toUnfoldable $ SigmaxTypes.graphNodes props.graph
let nodeSizeMin = maybe 0.0 _.size $ A.head nodesSorted
let nodeSizeMax = maybe 100.0 _.size $ A.last nodesSorted
...
...
@@ -128,8 +138,8 @@ controlsCpt = R.hooksComponent "GraphControls" cpt
RH.li {} [ centerButton props.sigmaRef ]
, RH.li {} [ pauseForceAtlasButton {state: props.forceAtlasState} ]
, RH.li {} [ edgesToggleButton {state: props.showEdges} ]
, RH.li {} [ edgeConfluenceControl
props.sigmaRef
props.edgeConfluence ]
, RH.li {} [ edgeWeightControl
props.sigmaRef
props.edgeWeight ]
, RH.li {} [ edgeConfluenceControl
edgeConfluenceRange
props.edgeConfluence ]
, RH.li {} [ edgeWeightControl
edgeWeightRange
props.edgeWeight ]
-- change level
-- file upload
-- run demo
...
...
@@ -148,9 +158,6 @@ controlsCpt = R.hooksComponent "GraphControls" cpt
useGraphControls :: SigmaxTypes.SGraph -> R.Hooks (Record Controls)
useGraphControls graph = do
let edges = SigmaxTypes.graphEdges graph
let nodes = SigmaxTypes.graphNodes graph
cursorSize <- R.useState' 10.0
edgeConfluence <- R.useState' $ Range.Closed { min: 0.0, max: 1.0 }
edgeWeight <- R.useState' $ Range.Closed { min: 0.0, max: 1.0 }
...
...
src/Gargantext/Components/GraphExplorer/RangeControl.purs
View file @
c57efdc4
...
...
@@ -34,12 +34,12 @@ rangeControlCpt = R.hooksComponent "RangeButton" cpt
, RS.rangeSlider sliderProps
]
edgeConfluenceControl :: R
.Ref Sigmax.Sigma
-> R.State Range.NumberRange -> R.Element
edgeConfluenceControl
sigmaRef
(state /\ setState) =
edgeConfluenceControl :: R
ange.NumberRange
-> R.State Range.NumberRange -> R.Element
edgeConfluenceControl
(Range.Closed { min, max })
(state /\ setState) =
rangeControl {
caption: "Edge Confluence Weight"
, sliderProps: {
bounds: Range.Closed { min
: 0.0, max: 1.0
}
bounds: Range.Closed { min
, max
}
, initialValue: state
, epsilon: 0.01
, step: 1.0
...
...
@@ -49,47 +49,32 @@ edgeConfluenceControl sigmaRef (state /\ setState) =
}
}
edgeWeightControl :: R
.Ref Sigmax.Sigma
-> R.State Range.NumberRange -> R.Element
edgeWeightControl
sigmaRef
(state /\ setState) =
edgeWeightControl :: R
ange.NumberRange
-> R.State Range.NumberRange -> R.Element
edgeWeightControl
(Range.Closed { min, max })
(state /\ setState) =
rangeControl {
caption: "Edge Weight"
, sliderProps: {
bounds: Range.Closed { min
: 0.0, max: 3.0
}
bounds: Range.Closed { min
, max
}
, initialValue: state
, epsilon: 0.01
, step: 1.0
, width: 10.0
, height: 5.0
, onChange: setState <<< const
-- , onChange: \range@(Range.Closed {min, max}) -> do
-- let sigma = R.readRef sigmaRef
-- Sigmax.dependOnSigma sigma "[edgeWeightControl] sigma: Nothing" $ \s -> do
-- Sigma.setSettings s {
-- minEdgeSize: min
-- , maxEdgeSize: max
-- }
-- setState $ const range
}
}
nodeSizeControl :: Range.NumberRange -> R.State Range.NumberRange -> R.Element
nodeSizeControl (Range.Closed { min
: rangeMin, max: rangeM
ax }) (state /\ setState) =
nodeSizeControl (Range.Closed { min
, m
ax }) (state /\ setState) =
rangeControl {
caption: "Node Size"
, sliderProps: {
bounds: Range.Closed { min
: rangeMin, max: rangeM
ax }
bounds: Range.Closed { min
, m
ax }
, initialValue: state
, epsilon: 0.1
, step: 1.0
, width: 10.0
, height: 5.0
, onChange: \range@(Range.Closed {min, max}) -> do
-- let sigma = R.readRef sigmaRef
-- Sigmax.dependOnSigma sigma "[nodeSizeControl] sigma: Nothing" $ \s -> do
-- Sigma.setSettings s {
-- minNodeSize: min
-- , maxNodeSize: max
-- }
setState $ const range
, onChange: setState <<< const
}
}
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