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
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
gargantext
purescript-gargantext
Commits
6469b1b6
Commit
6469b1b6
authored
Dec 19, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Demo Version] Graph Title / Legend / Side Right Panel / Role fixed.
parent
b0ddf801
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
19 deletions
+14
-19
Types.purs
src/Gargantext/Components/GraphExplorer/Types.purs
+7
-12
Specs.purs
src/Gargantext/Pages/Annuaire/User/Contacts/Specs.purs
+2
-2
Graph.purs
src/Gargantext/Pages/Corpus/Graph.purs
+5
-5
No files found.
src/Gargantext/Components/GraphExplorer/Types.purs
View file @
6469b1b6
...
...
@@ -46,6 +46,7 @@ newtype GraphData = GraphData
derive instance newtypeGraphData :: Newtype GraphData _
newtype MetaData = MetaData
{
title :: String
...
...
@@ -91,8 +92,9 @@ instance decodeJsonLegend :: DecodeJson Legend where
decodeJson json = do
obj <- decodeJson json
id_ <- obj .? "id"
color <- obj .? "color"
label <- obj .? "label"
pure $ Legend { id_, label }
pure $ Legend { id_,
color,
label }
instance decodeJsonCluster :: DecodeJson Cluster where
...
...
@@ -110,7 +112,7 @@ instance decodeJsonEdge :: DecodeJson Edge where
weight <- obj .? "weight"
pure $ Edge { id_, source, target, weight }
newtype Legend = Legend {id_ ::Int , label :: String}
newtype Legend = Legend {id_ ::Int ,
color :: String,
label :: String}
instance eqLegend :: Eq Legend where
eq (Legend l1) (Legend l2) = eq l1.id_ l2.id_
...
...
@@ -119,16 +121,9 @@ instance ordLegend :: Ord Legend where
compare (Legend l1) (Legend l2) = compare l1.id_ l2.id_
getLegendData :: GraphData -> Array Legend
getLegendData (GraphData {nodes, edges}) = nn
where
--mp (NonEmptyArray a ary) = [a] <> (if length ary > 0 then [unsafePartial $ fromJust $ head ary] else [])
n = sort $ map t' nodes
g = group n
nn = take 5 $ concat $ map fromFoldable g -- TODO: fix this after checking the output
t' :: Node -> Legend
t' (Node r) = Legend { id_ : clustDefault, label : r.label}
getLegendData (GraphData {nodes, edges, metaData}) = getLegend metaData
where
(Cluster {clustDefault}) = r.attributes
getLegend (Just (MetaData {legend})) = legend
getLegend Nothing = []
src/Gargantext/Pages/Annuaire/User/Contacts/Specs.purs
View file @
6469b1b6
...
...
@@ -68,9 +68,9 @@ getLastName' = fromMaybe "Empty last name" <<< _.lastName <<< unwrap
-- | ContactWhere infos
-- TODO factor below
getRole :: Array ContactWhere -> String
getRole
obj = joinWith ", " $ getRole' <$> obj
getRole
= maybe "Empty Contact-Where" getRole' <<< head
where
getRole' = fromMaybe "Empty
r
ole" <<< _.role <<< unwrap
getRole' = fromMaybe "Empty
R
ole" <<< _.role <<< unwrap
getOrga :: Array ContactWhere -> String
getOrga = maybe "Emtpy Contact-Where" getOrga' <<< head
...
...
src/Gargantext/Pages/Corpus/Graph.purs
View file @
6469b1b6
...
...
@@ -96,7 +96,6 @@ performAction (LoadGraph fp) _ _ = void do
Just (AuthData {token,tree_id }) ->
modifyState \(State s) -> State s {graphData = resp, sigmaGraphData = Just $ convert resp, legendData = getLegendData resp, treeId = Just tree_id}
Nothing ->
modifyState \(State s) -> State s { graphData = resp, sigmaGraphData = Just $ convert resp, legendData = getLegendData resp, treeId = Nothing}
-- TODO: here one might `catchError getNodes` to visually empty the
-- graph.
...
...
@@ -155,8 +154,9 @@ render d p (State s) c =
, edgeShapes {"default" : edgeShape.curve}
]
]
<>
[dispLegend s.legendData]
-- TODO clean unused code: this seems to be not used
-- <>
-- [dispLegend s.legendData]
forceAtlas2Config :: { slowDown :: Number
, startingIterations :: Number
...
...
@@ -290,9 +290,9 @@ nOverlap ns = { nodes : ns
dispLegend :: Array Legend -> ReactElement
dispLegend ary = div [] $ map dl ary
where
dl (Legend {id_, label}) =
dl (Legend {id_,
color,
label}) =
p []
[ span [style {width : 10, height : 10, backgroundColor : intColor id_, display: "inline-block"}] []
[ span [style {width : 10, height : 10, backgroundColor : intColor id_
, display: "inline-block"}] []
, text $ " " <> label
]
...
...
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