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
137
Issues
137
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
930256db
Commit
930256db
authored
Nov 07, 2022
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WIP] [Docs histo] Legend change types
parent
09ec80f7
Pipeline
#3388
failed with stage
in 0 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
23 deletions
+43
-23
ECharts.purs
src/Gargantext/Components/Charts/Options/ECharts.purs
+15
-11
Type.purs
src/Gargantext/Components/Charts/Options/Type.purs
+9
-1
Common.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
+5
-2
Types.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Types.purs
+7
-6
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+7
-3
No files found.
src/Gargantext/Components/Charts/Options/ECharts.purs
View file @
930256db
...
@@ -11,7 +11,7 @@ import Gargantext.Components.Charts.Options.Font (IconOptions(..), Shape(..), Te
...
@@ -11,7 +11,7 @@ import Gargantext.Components.Charts.Options.Font (IconOptions(..), Shape(..), Te
import Gargantext.Components.Charts.Options.Legend (legendType, LegendMode(..), PlainOrScroll(..), selectedMode, Orientation(..), orient)
import Gargantext.Components.Charts.Options.Legend (legendType, LegendMode(..), PlainOrScroll(..), selectedMode, Orientation(..), orient)
import Gargantext.Components.Charts.Options.Position (Align(..), LeftRelativePosition(..), TopRelativePosition(..), numberPosition, percentPosition, relativePosition)
import Gargantext.Components.Charts.Options.Position (Align(..), LeftRelativePosition(..), TopRelativePosition(..), numberPosition, percentPosition, relativePosition)
import Gargantext.Components.Charts.Options.Series (Series, seriesPieD1)
import Gargantext.Components.Charts.Options.Series (Series, seriesPieD1)
import Gargantext.Components.Charts.Options.Type (DataZoom, EChart
sInstance, Echarts, Legend, MouseEvent, Option, Title, XAxis, YAxis, EChartRef
, xAxis, yAxis)
import Gargantext.Components.Charts.Options.Type (DataZoom, EChart
Ref, EChartsInstance, Echarts, Legend, MouseEvent, Option, Title, XAxis, YAxis
, xAxis, yAxis)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Prelude
import Prelude
import React (ReactClass, unsafeCreateElementDynamic)
import React (ReactClass, unsafeCreateElementDynamic)
...
@@ -45,11 +45,14 @@ chartWith options =
...
@@ -45,11 +45,14 @@ chartWith options =
, ref : refListener options
, ref : refListener options
}
}
where
where
getEvents (Options { onClick }) =
getEvents (Options { onClick
, onLegendChanged
}) =
{ click: listenerFn1 \e -> case onClick of
{ click: listenerFn1 \e -> case onClick of
-- sanitize parsing (see MouseEvent comment)
-- sanitize parsing (see MouseEvent comment)
Just fn -> RX.pick (e :: MouseEvent) # fn
Just fn -> RX.pick (e :: MouseEvent) # fn
Nothing -> pure unit
Nothing -> pure unit
, legendselectchanged: listenerFn1 \e -> case onLegendChanged of
Just fn -> fn e
Nothing -> pure unit
}
}
refListener (Options { onInit }) = case onInit of
refListener (Options { onInit }) = case onInit of
...
@@ -174,14 +177,15 @@ yAxis' {position, show, min} = yAxis
...
@@ -174,14 +177,15 @@ yAxis' {position, show, min} = yAxis
}
}
data Options = Options
data Options = Options
{ mainTitle :: MainTitle
{ mainTitle :: MainTitle
, subTitle :: SubTitle
, subTitle :: SubTitle
, xAxis :: XAxis
, xAxis :: XAxis
, yAxis :: YAxis
, yAxis :: YAxis
, series :: Array Series
, series :: Array Series
, addZoom :: Boolean
, addZoom :: Boolean
, tooltip :: Tooltip
, tooltip :: Tooltip
, onClick :: Maybe (MouseEvent -> Effect Unit)
, onClick :: Maybe (MouseEvent -> Effect Unit)
, onLegendChanged :: Maybe (MouseEvent -> Effect Unit)
-- (?) `onInit` custom listener
-- (?) `onInit` custom listener
--
--
-- * in addition of the already existing `onReady` native listener
-- * in addition of the already existing `onReady` native listener
...
@@ -194,7 +198,7 @@ data Options = Options
...
@@ -194,7 +198,7 @@ data Options = Options
-- library actions
-- library actions
--
--
-- [1] https://echarts.apache.org/v4/en/api.html#echarts.init
-- [1] https://echarts.apache.org/v4/en/api.html#echarts.init
, onInit :: Maybe (EChartsInstance -> Effect Unit)
, onInit
:: Maybe (EChartsInstance -> Effect Unit)
}
}
tooltipTriggerAxis :: Tooltip
tooltipTriggerAxis :: Tooltip
...
...
src/Gargantext/Components/Charts/Options/Type.purs
View file @
930256db
...
@@ -175,7 +175,8 @@ type Rich = {}
...
@@ -175,7 +175,8 @@ type Rich = {}
-- | "echarts/dist/echarts.common.js" and
-- | "echarts/dist/echarts.common.js" and
-- | https://echarts.apache.org/en/api.html#events
-- | https://echarts.apache.org/en/api.html#events
type OnEvents =
type OnEvents =
{ click :: Effect Unit
{ click :: Effect Unit
, legendselectchanged :: Effect Unit
-- ...
-- ...
}
}
...
@@ -206,6 +207,13 @@ type MouseEvent =
...
@@ -206,6 +207,13 @@ type MouseEvent =
, value :: String -- or Array ??
, value :: String -- or Array ??
}
}
-- | https://echarts.apache.org/en/api.html#events.legendselectchanged
type LegendSelectChangedEvent =
{ type :: String
, name :: String
, selected :: Array String -- ??
}
----
----
-- | @XXX partial definition given by the third library author
-- | @XXX partial definition given by the third library author
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
View file @
930256db
...
@@ -44,10 +44,12 @@ metricsLoadViewCpt = here.component "metricsLoadView" cpt
...
@@ -44,10 +44,12 @@ metricsLoadViewCpt = here.component "metricsLoadView" cpt
, session } _ = do
, session } _ = do
reload' <- T.useLive T.unequal reload
reload' <- T.useLive T.unequal reload
let onLegendChanged = Nothing
useLoader { errorHandler
useLoader { errorHandler
, loader: getMetrics session
, loader: getMetrics session
, path: reload' /\ path
, path: reload' /\ path
, render: \l -> loaded { boxes, path, reload, session, onClick, onInit } l }
, render: \l -> loaded { boxes, path, reload, session, onClick, on
LegendChanged, on
Init } l }
where
where
errorHandler error = do
errorHandler error = do
T.modify_ (A.cons $ FRESTError { error }) errors
T.modify_ (A.cons $ FRESTError { error }) errors
...
@@ -79,6 +81,7 @@ metricsWithCacheLoadViewCpt = here.component "metricsWithCacheLoadView" cpt
...
@@ -79,6 +81,7 @@ metricsWithCacheLoadViewCpt = here.component "metricsWithCacheLoadView" cpt
, reload
, reload
, session
, session
, onClick
, onClick
, onLegendChanged
, onInit } _ = do
, onInit } _ = do
reload' <- T.useLive T.unequal reload
reload' <- T.useLive T.unequal reload
...
@@ -87,5 +90,5 @@ metricsWithCacheLoadViewCpt = here.component "metricsWithCacheLoadView" cpt
...
@@ -87,5 +90,5 @@ metricsWithCacheLoadViewCpt = here.component "metricsWithCacheLoadView" cpt
, handleResponse
, handleResponse
, mkRequest
, mkRequest
, path: (reload' /\ path)
, path: (reload' /\ path)
, renderer: loaded { boxes, path, reload, session, onClick, onInit }
, renderer: loaded { boxes, path, reload, session, onClick, on
LegendChanged, on
Init }
, spinnerClass: Just "echarts-for-react-spinner" }
, spinnerClass: Just "echarts-for-react-spinner" }
src/Gargantext/Components/Nodes/Corpus/Chart/Types.purs
View file @
930256db
...
@@ -4,7 +4,7 @@ import Data.Maybe (Maybe)
...
@@ -4,7 +4,7 @@ import Data.Maybe (Maybe)
import Data.Tuple (Tuple)
import Data.Tuple (Tuple)
import Effect (Effect)
import Effect (Effect)
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.Charts.Options.Type (EChartsInstance, MouseEvent)
import Gargantext.Components.Charts.Options.Type (EChartsInstance, MouseEvent
, LegendSelectChangedEvent
)
import Gargantext.Prelude (Unit)
import Gargantext.Prelude (Unit)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (TabType)
import Gargantext.Types (TabType)
...
@@ -18,11 +18,12 @@ type Path = (
...
@@ -18,11 +18,12 @@ type Path = (
)
)
type Props = (
type Props = (
boxes :: Boxes
boxes :: Boxes
, path :: Record Path
, path :: Record Path
, session :: Session
, session :: Session
, onClick :: Maybe (MouseEvent -> Effect Unit)
, onClick :: Maybe (MouseEvent -> Effect Unit)
, onInit :: Maybe (EChartsInstance -> Effect Unit)
, onLegendChanged :: Maybe (LegendSelectChangedEvent -> Effect Unit)
, onInit :: Maybe (EChartsInstance -> Effect Unit)
)
)
type MetricsProps = (
type MetricsProps = (
...
...
src/Gargantext/Components/Nodes/Texts.purs
View file @
930256db
...
@@ -2,6 +2,7 @@ module Gargantext.Components.Nodes.Texts where
...
@@ -2,6 +2,7 @@ module Gargantext.Components.Nodes.Texts where
import Gargantext.Prelude
import Gargantext.Prelude
import DOM.Simple.Console (log)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..), isJust)
import Data.Maybe (Maybe(..), isJust)
import Data.Show.Generic (genericShow)
import Data.Show.Generic (genericShow)
...
@@ -204,6 +205,9 @@ tabsCpt = here.component "tabs" cpt
...
@@ -204,6 +205,9 @@ tabsCpt = here.component "tabs" cpt
}
}
dispatchAction i { type: "downplay" }
dispatchAction i { type: "downplay" }
dispatchAction i opts'
dispatchAction i opts'
onLegendChanged = Just \opts -> do
log opts
activeTab <- T.useBox 0
activeTab <- T.useBox 0
...
@@ -215,7 +219,7 @@ tabsCpt = here.component "tabs" cpt
...
@@ -215,7 +219,7 @@ tabsCpt = here.component "tabs" cpt
, activeTab
, activeTab
, tabs: [
, tabs: [
"Documents" /\ R.fragment [
"Documents" /\ R.fragment [
histoRender { boxes, path, onClick, onInit, reload: chartReload, session } []
histoRender { boxes, path, onClick, on
LegendChanged, on
Init, reload: chartReload, session } []
, docView' path chartReload TabDocs
, docView' path chartReload TabDocs
]
]
, "Trash" /\ docView' path chartReload TabTrash
, "Trash" /\ docView' path chartReload TabTrash
...
@@ -252,10 +256,10 @@ histoRender :: R2.Component HistoProps
...
@@ -252,10 +256,10 @@ histoRender :: R2.Component HistoProps
histoRender = R.createElement histoRenderCpt
histoRender = R.createElement histoRenderCpt
histoRenderCpt :: R.Component HistoProps
histoRenderCpt :: R.Component HistoProps
histoRenderCpt = here.component "histoRender" cpt where
histoRenderCpt = here.component "histoRender" cpt where
cpt { boxes, path, onClick, onInit, reload, session } _ = do
cpt { boxes, path, onClick, on
LegendChanged, on
Init, reload, session } _ = do
_ <- T.useLive T.unequal reload
_ <- T.useLive T.unequal reload
pure $ histo { boxes, path, onClick, onInit, session }
pure $ histo { boxes, path, onClick, on
LegendChanged, on
Init, session }
type DocViewProps a =
type DocViewProps a =
( boxes :: Boxes
( boxes :: Boxes
...
...
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