Commit f794707a authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[Graph] some small fixes to types, edge hover precision

parent 4cab26ba
...@@ -136,7 +136,7 @@ type SigmaSettings = ...@@ -136,7 +136,7 @@ type SigmaSettings =
-- , edgeColor :: String -- , edgeColor :: String
, edgeHoverColor :: String , edgeHoverColor :: String
, edgeHoverExtremities :: Boolean , edgeHoverExtremities :: Boolean
-- , edgeHoverPrecision :: Number , edgeHoverPrecision :: Number
, edgeHoverSizeRatio :: Number , edgeHoverSizeRatio :: Number
-- , edgesPowRatio :: Number -- , edgesPowRatio :: Number
-- , enableCamera :: Boolean -- , enableCamera :: Boolean
...@@ -218,6 +218,7 @@ sigmaSettings = ...@@ -218,6 +218,7 @@ sigmaSettings =
, enableEdgeHovering: true , enableEdgeHovering: true
, edgeHoverExtremities: true , edgeHoverExtremities: true
, edgeHoverColor: "edge" , edgeHoverColor: "edge"
, edgeHoverPrecision: 2.0
, edgeHoverSizeRatio: 2.0 , edgeHoverSizeRatio: 2.0
, enableHovering: true , enableHovering: true
, font: "Droid Sans" -- font params , font: "Droid Sans" -- font params
...@@ -226,7 +227,7 @@ sigmaSettings = ...@@ -226,7 +227,7 @@ sigmaSettings =
, labelSize : "fixed" , labelSize : "fixed"
, labelSizeRatio: 1.0 -- label size in ratio of node size , labelSizeRatio: 1.0 -- label size in ratio of node size
, labelThreshold: 1.0 -- min node cam size to start showing label , labelThreshold: 1.0 -- min node cam size to start showing label
, maxEdgeSize: 1.0 , maxEdgeSize: 2.0
, maxNodeSize: 10.0 , maxNodeSize: 10.0
, minEdgeSize: 0.5 -- in fact used in tina as edge size , minEdgeSize: 0.5 -- in fact used in tina as edge size
, minNodeSize: 5.0 , minNodeSize: 5.0
......
...@@ -215,9 +215,9 @@ convert (GET.GraphData r) = Tuple r.metaData $ SigmaxTypes.Graph {nodes, edges} ...@@ -215,9 +215,9 @@ convert (GET.GraphData r) = Tuple r.metaData $ SigmaxTypes.Graph {nodes, edges}
} }
where where
cDef (GET.Cluster {clustDefault}) = clustDefault cDef (GET.Cluster {clustDefault}) = clustDefault
nodesMap = SigmaxTypes.nodesMap $ Seq.toUnfoldable nodes nodesMap = SigmaxTypes.nodesMap nodes
edges = foldMap edgeFn r.edges edges = foldMap edgeFn r.edges
edgeFn (GET.Edge e) = Seq.singleton {id : e.id_, color, size: 1.5, source : e.source, target : e.target} edgeFn (GET.Edge e) = Seq.singleton {id : e.id_, color, size: 1.0, source : e.source, target : e.target}
where where
color = case Map.lookup e.source nodesMap of color = case Map.lookup e.source nodesMap of
Nothing -> "#000000" Nothing -> "#000000"
......
...@@ -2,7 +2,7 @@ module Gargantext.Hooks.Sigmax.Types where ...@@ -2,7 +2,7 @@ module Gargantext.Hooks.Sigmax.Types where
import Prelude (map, ($), (&&), (==)) import Prelude (map, ($), (&&), (==))
import Data.Map as Map import Data.Map as Map
import Data.Sequence (Seq, toUnfoldable) import Data.Sequence (Seq)
import Data.Set as Set import Data.Set as Set
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import DOM.Simple.Types (Element) import DOM.Simple.Types (Element)
...@@ -43,13 +43,13 @@ edgesGraphMap graph = do ...@@ -43,13 +43,13 @@ edgesGraphMap graph = do
let (Graph {edges}) = graph let (Graph {edges}) = graph
Map.fromFoldable $ map (\e -> Tuple e.id e) edges Map.fromFoldable $ map (\e -> Tuple e.id e) edges
nodesMap :: Array (Record Node) -> NodesMap nodesMap :: Seq (Record Node) -> NodesMap
nodesMap nodes = Map.fromFoldable $ map (\n -> Tuple n.id n) nodes nodesMap nodes = Map.fromFoldable $ map (\n -> Tuple n.id n) nodes
nodesGraphMap :: Graph Node Edge -> NodesMap nodesGraphMap :: Graph Node Edge -> NodesMap
nodesGraphMap graph = do nodesGraphMap graph = do
let (Graph {nodes}) = graph let (Graph {nodes}) = graph
nodesMap $ toUnfoldable nodes nodesMap nodes
eqGraph :: (Graph Node Edge) -> (Graph Node Edge) -> Boolean eqGraph :: (Graph Node Edge) -> (Graph Node Edge) -> Boolean
eqGraph (Graph {nodes: n1, edges: e1}) (Graph {nodes: n2, edges: e2}) = (n1 == n2) && (e1 == e2) eqGraph (Graph {nodes: n1, edges: e1}) (Graph {nodes: n2, edges: e2}) = (n1 == n2) && (e1 == e2)
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