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
Christian Merten
purescript-gargantext
Commits
1a54188e
Verified
Commit
1a54188e
authored
Apr 23, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[graph] add edge weight control
parent
15fb46ca
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
22 deletions
+25
-22
Layout.purs
src/Gargantext/Components/GraphExplorer/Layout.purs
+2
-2
Controls.purs
...Gargantext/Components/GraphExplorer/Toolbar/Controls.purs
+13
-14
RangeControl.purs
...antext/Components/GraphExplorer/Toolbar/RangeControl.purs
+1
-1
Graph.purs
src/Gargantext/Components/Nodes/Graph.purs
+9
-5
No files found.
src/Gargantext/Components/GraphExplorer/Layout.purs
View file @
1a54188e
...
@@ -450,8 +450,8 @@ transformGraph graph { edgeConfluence'
...
@@ -450,8 +450,8 @@ transformGraph graph { edgeConfluence'
edge { hidden = true }
edge { hidden = true }
edgeHideWeight :: Record SigmaxT.Edge -> Record SigmaxT.Edge
edgeHideWeight :: Record SigmaxT.Edge -> Record SigmaxT.Edge
edgeHideWeight edge@{ weight
Idx
} =
edgeHideWeight edge@{ weight } =
if Range.within edgeWeight'
$ toNumber weightIdx
then
if Range.within edgeWeight'
weight
then
edge
edge
else
else
edge { hidden = true }
edge { hidden = true }
...
...
src/Gargantext/Components/GraphExplorer/Toolbar/Controls.purs
View file @
1a54188e
...
@@ -11,7 +11,7 @@ import Effect.Timer (setTimeout)
...
@@ -11,7 +11,7 @@ import Effect.Timer (setTimeout)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.GraphExplorer.Store as GraphStore
import Gargantext.Components.GraphExplorer.Store as GraphStore
import Gargantext.Components.GraphExplorer.Toolbar.Buttons (cameraButton, centerButton, edgesToggleButton, louvainButton, pauseForceAtlasButton, pauseNoverlapButton, multiSelectEnabledButton)
import Gargantext.Components.GraphExplorer.Toolbar.Buttons (cameraButton, centerButton, edgesToggleButton, louvainButton, pauseForceAtlasButton, pauseNoverlapButton, multiSelectEnabledButton)
import Gargantext.Components.GraphExplorer.Toolbar.RangeControl (edgeConfluenceControl, nodeSizeControl)
import Gargantext.Components.GraphExplorer.Toolbar.RangeControl (edgeConfluenceControl,
edgeWeightControl,
nodeSizeControl)
import Gargantext.Components.GraphExplorer.Toolbar.SlideButton (labelSizeButton, labelRenderedSizeThresholdButton, mouseSelectorSizeSlider)
import Gargantext.Components.GraphExplorer.Toolbar.SlideButton (labelSizeButton, labelRenderedSizeThresholdButton, mouseSelectorSizeSlider)
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas
import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas
...
@@ -52,7 +52,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
...
@@ -52,7 +52,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
-- |
-- |
{ edgeConfluence
{ edgeConfluence
, edgeConfluenceRange
, edgeConfluenceRange
--
, edgeWeight
, edgeWeight
, forceAtlasState
, forceAtlasState
, noverlapState
, noverlapState
, graph
, graph
...
@@ -80,6 +80,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
...
@@ -80,6 +80,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
selectedNodeIds' <- R2.useLive' selectedNodeIds
selectedNodeIds' <- R2.useLive' selectedNodeIds
showSidebar' <- R2.useLive' showSidebar
showSidebar' <- R2.useLive' showSidebar
edgeConfluenceRange' <- R2.useLive' edgeConfluenceRange
edgeConfluenceRange' <- R2.useLive' edgeConfluenceRange
edgeWeight' <- R2.useLive' edgeWeight
nodeSizeRange' <- R2.useLive' nodeSizeRange
nodeSizeRange' <- R2.useLive' nodeSizeRange
-- session <- useSession
-- session <- useSession
...
@@ -207,12 +208,10 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
...
@@ -207,12 +208,10 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
}
}
,
,
gap, gap
gap, gap
,
, edgeWeightControl
labelRenderedSizeThresholdButton
{ forceAtlasState
{ forceAtlasState
, range: edgeWeight'
, sigmaRef
, state: edgeWeight }
, state: labelRenderedSizeThreshold
}
]
]
,
,
-- Run spatialization
-- Run spatialization
...
@@ -321,12 +320,12 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
...
@@ -321,12 +320,12 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
{ forceAtlasState
{ forceAtlasState
, range: edgeConfluenceRange'
, range: edgeConfluenceRange'
, state: edgeConfluence }
, state: edgeConfluence }
{- ,
, gap
edgeWeightControl
, labelRenderedSizeThresholdButton
{ forceAtlasState
{ forceAtlasState
, range: edgeWeightRange
, sigmaRef
, state: edgeWeight }
, state: labelRenderedSizeThreshold
-
}
}
,
,
gap, gap
gap, gap
,
,
...
...
src/Gargantext/Components/GraphExplorer/Toolbar/RangeControl.purs
View file @
1a54188e
...
@@ -99,7 +99,7 @@ edgeWeightControlCpt = here.component "edgeWeightControl" cpt
...
@@ -99,7 +99,7 @@ edgeWeightControlCpt = here.component "edgeWeightControl" cpt
, sliderProps: {
, sliderProps: {
bounds: Range.Closed { min, max }
bounds: Range.Closed { min, max }
, initialValue: state'
, initialValue: state'
, epsilon:
1
.0
, epsilon:
(max - min) / 100
.0
, height: 5.0
, height: 5.0
, onChange: \rng -> T.write_ rng state
, onChange: \rng -> T.write_ rng state
, status: SigmaxTypes.forceAtlasComponentStatus forceAtlasState'
, status: SigmaxTypes.forceAtlasComponentStatus forceAtlasState'
...
...
src/Gargantext/Components/Nodes/Graph.purs
View file @
1a54188e
...
@@ -5,8 +5,8 @@ module Gargantext.Components.Nodes.Graph
...
@@ -5,8 +5,8 @@ module Gargantext.Components.Nodes.Graph
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Array as A
import Data.Array as A
import Data.
Int as I
import Data.
Foldable (minimum, maximum)
import Data.Maybe (Maybe(..), isJust, maybe)
import Data.Maybe (Maybe(..), isJust,
fromMaybe,
maybe)
import Data.Sequence as Seq
import Data.Sequence as Seq
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import DOM.Simple (document, querySelector)
import DOM.Simple (document, querySelector)
...
@@ -184,10 +184,14 @@ hydrateStoreCpt = here.component "hydrateStore" cpt where
...
@@ -184,10 +184,14 @@ hydrateStoreCpt = here.component "hydrateStore" cpt where
let nodeSizeMax = maybe 100.0 _.size $ A.last nodesSorted
let nodeSizeMax = maybe 100.0 _.size $ A.last nodesSorted
let nodeSizeRange = Range.Closed { min: nodeSizeMin, max: nodeSizeMax }
let nodeSizeRange = Range.Closed { min: nodeSizeMin, max: nodeSizeMax }
-- let edgeWeight = Range.Closed
-- { min: 0.0
-- , max: I.toNumber $ Seq.length $ SigmaxT.graphEdges graph
-- }
let weightsSeq = Seq.map _.weight $ SigmaxT.graphEdges graph
let edgeWeight = Range.Closed
let edgeWeight = Range.Closed
{ min: 0.0
{ min: fromMaybe 0.0 $ minimum weightsSeq
, max: I.toNumber $ Seq.length $ SigmaxT.graphEdges graph
, max: fromMaybe 1.0 $ maximum weightsSeq } :: Range.Closed Number
}
let transformedGraph = transformGraph graph { edgeConfluence': GraphStore.options.edgeConfluence
let transformedGraph = transformGraph graph { edgeConfluence': GraphStore.options.edgeConfluence
, edgeWeight': edgeWeight
, edgeWeight': edgeWeight
...
...
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