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'
edge { hidden = true }
edgeHideWeight :: Record SigmaxT.Edge -> Record SigmaxT.Edge
edgeHideWeight edge@{ weight
Idx
} =
if Range.within edgeWeight'
$ toNumber weightIdx
then
edgeHideWeight edge@{ weight } =
if Range.within edgeWeight'
weight
then
edge
else
edge { hidden = true }
...
...
src/Gargantext/Components/GraphExplorer/Toolbar/Controls.purs
View file @
1a54188e
...
...
@@ -11,7 +11,7 @@ import Effect.Timer (setTimeout)
import Gargantext.Components.Bootstrap as B
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.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.Types as GET
import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas
...
...
@@ -52,7 +52,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
-- |
{ edgeConfluence
, edgeConfluenceRange
--
, edgeWeight
, edgeWeight
, forceAtlasState
, noverlapState
, graph
...
...
@@ -80,6 +80,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
selectedNodeIds' <- R2.useLive' selectedNodeIds
showSidebar' <- R2.useLive' showSidebar
edgeConfluenceRange' <- R2.useLive' edgeConfluenceRange
edgeWeight' <- R2.useLive' edgeWeight
nodeSizeRange' <- R2.useLive' nodeSizeRange
-- session <- useSession
...
...
@@ -207,12 +208,10 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
}
,
gap, gap
,
labelRenderedSizeThresholdButton
{ forceAtlasState
, sigmaRef
, state: labelRenderedSizeThreshold
}
, edgeWeightControl
{ forceAtlasState
, range: edgeWeight'
, state: edgeWeight }
]
,
-- Run spatialization
...
...
@@ -321,12 +320,12 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
{ forceAtlasState
, range: edgeConfluenceRange'
, state: edgeConfluence }
{- ,
edgeWeightControl
{ forceAtlasState
, range: edgeWeightRange
, state: edgeWeight }
-
}
, gap
, labelRenderedSizeThresholdButton
{ forceAtlasState
, sigmaRef
, state: labelRenderedSizeThreshold
}
,
gap, gap
,
...
...
src/Gargantext/Components/GraphExplorer/Toolbar/RangeControl.purs
View file @
1a54188e
...
...
@@ -99,7 +99,7 @@ edgeWeightControlCpt = here.component "edgeWeightControl" cpt
, sliderProps: {
bounds: Range.Closed { min, max }
, initialValue: state'
, epsilon:
1
.0
, epsilon:
(max - min) / 100
.0
, height: 5.0
, onChange: \rng -> T.write_ rng state
, status: SigmaxTypes.forceAtlasComponentStatus forceAtlasState'
...
...
src/Gargantext/Components/Nodes/Graph.purs
View file @
1a54188e
...
...
@@ -5,8 +5,8 @@ module Gargantext.Components.Nodes.Graph
import Gargantext.Prelude
import Data.Array as A
import Data.
Int as I
import Data.Maybe (Maybe(..), isJust, maybe)
import Data.
Foldable (minimum, maximum)
import Data.Maybe (Maybe(..), isJust,
fromMaybe,
maybe)
import Data.Sequence as Seq
import Data.Tuple (Tuple(..))
import DOM.Simple (document, querySelector)
...
...
@@ -184,10 +184,14 @@ hydrateStoreCpt = here.component "hydrateStore" cpt where
let nodeSizeMax = maybe 100.0 _.size $ A.last nodesSorted
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
{ min: 0.0
, max: I.toNumber $ Seq.length $ SigmaxT.graphEdges graph
}
{ min: fromMaybe 0.0 $ minimum weightsSeq
, max: fromMaybe 1.0 $ maximum weightsSeq } :: Range.Closed Number
let transformedGraph = transformGraph graph { edgeConfluence': GraphStore.options.edgeConfluence
, 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