[graph] add edge weight control

parent 15fb46ca
Pipeline #5987 passed with stages
in 17 minutes and 12 seconds
......@@ -450,8 +450,8 @@ transformGraph graph { edgeConfluence'
edge { hidden = true }
edgeHideWeight :: Record SigmaxT.Edge -> Record SigmaxT.Edge
edgeHideWeight edge@{ weightIdx } =
if Range.within edgeWeight' $ toNumber weightIdx then
edgeHideWeight edge@{ weight } =
if Range.within edgeWeight' weight then
edge
else
edge { hidden = true }
......
......@@ -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
,
......
......@@ -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'
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment