Commit 1ed34b98 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[GraphExplorer] fix forceAtlas settings

parent f1cff044
......@@ -52,7 +52,7 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
cpt { elRef
, fa2Ref
, sigmaRef
, forceAtlas2Settings: fa2
, forceAtlas2Settings: fa2Settings
, transformedGraph
} _ = do
......@@ -136,7 +136,7 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
if startForceAtlas' then
case R.readRef fa2Ref of
Nothing -> do
fa2 <- ForceAtlas2.init (Sigma.graph sig)
fa2 <- ForceAtlas2.init (Sigma.graph sig) fa2Settings
ForceAtlas2.start fa2
R.setRef fa2Ref (Just fa2)
Just fa2 -> do
......@@ -389,7 +389,7 @@ type ForceAtlas2Settings =
-- , worker :: Boolean
)
forceAtlas2Settings :: {|ForceAtlas2Settings}
forceAtlas2Settings :: Record ForceAtlas2Settings
forceAtlas2Settings =
{ adjustSizes : true
, barnesHutOptimize : true
......@@ -405,7 +405,7 @@ forceAtlas2Settings =
, outboundAttractionDistribution : false
, scalingRatio : 1000.0
, skipHidden : false
, slowDown : 1.0
, slowDown : 0.2
, startingIterations : 10.0
, strongGravityMode : false
}
......@@ -2,11 +2,13 @@
// https://graphology.github.io/standard-library/layout-forceatlas2.html
// import forceAtlas2 from 'graphology-layout-forceatlas2';
import FA2Layout from 'graphology-layout-forceatlas2/worker';
export function _init(graph) {
export function _init(graph, settings) {
// let inferred = forceAtlas2.inferSettings(graph);
return new FA2Layout(graph, {
settings: {gravity: 1},
settings,
getEdgeWeight: 'weight'
})
}
......
......@@ -21,14 +21,14 @@ foreign import data FA2Layout :: Type
-- TODO inferSettings
-- TODO init with settings
foreign import _init :: EffectFn1 Graphology.Graph FA2Layout
foreign import _init :: forall settings. EffectFn2 Graphology.Graph settings FA2Layout
foreign import _start :: EffectFn1 FA2Layout Unit
foreign import _stop :: EffectFn1 FA2Layout Unit
foreign import _kill :: EffectFn1 FA2Layout Unit
foreign import _isRunning :: EffectFn1 FA2Layout Boolean
init :: Graphology.Graph -> Effect FA2Layout
init = runEffectFn1 _init
init :: forall settings. Graphology.Graph -> settings -> Effect FA2Layout
init = runEffectFn2 _init
start :: FA2Layout -> Effect Unit
start = runEffectFn1 _start
......
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