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
5bbc4bc6
Commit
5bbc4bc6
authored
Apr 24, 2018
by
Mael NICOLAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working on type
parent
24006ff8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
114 additions
and
33 deletions
+114
-33
Chart.purs
src/Chart.purs
+114
-33
No files found.
src/Chart.purs
View file @
5bbc4bc6
...
...
@@ -3,10 +3,11 @@ module Chart where
import Prelude
import CSS (Color, white)
import
React.DOM.Props (Props, unsafeFromPropsArray, unsafeMkProps
)
import
Data.Maybe (Maybe(..)
)
import React as R
import React.DOM (p)
import React.DOM.Props (Props, className, unsafeFromPropsArray)
import React.DOM.Props (Props, unsafeFromPropsArray, unsafeMkProps)
import ReactDOM as RDOM
import Thermite (Render, Spec, createReactSpec, defaultPerformAction, simpleSpec)
...
...
@@ -57,14 +58,14 @@ type OptsLoading =
}
type Option =
{ title :: Title
, legend :: Legend
, tooltip :: Tooltip
, grid :: Grid
, xAxis :: Array XAxis
, yAxis :: Array YAxis
, series :: Array Series
, dataZoom :: Array DataZoom
{ title ::
Maybe
Title
, legend ::
Maybe
Legend
, tooltip ::
Maybe
Tooltip
, grid ::
Maybe
Grid
, xAxis ::
Maybe
Array XAxis
, yAxis ::
Maybe
Array YAxis
, series ::
Maybe
Array Series
, dataZoom ::
Maybe
Array DataZoom
}
...
...
@@ -81,33 +82,33 @@ type Grid =
}
type Legend =
{"type" :: String
, show :: Boolean
, zlevel :: Number
, z :: Number
, left :: Number
, top :: Number
, right :: Number
, bottom :: Number
, width :: Number
, height :: Number
, orient :: String
, align :: String
, padding :: Number
, itemGap :: Number
, itemWidth :: Number
, itemHeight :: Number
, formatter :: String
, selectedMode :: Boolean
, inactiveColor :: Color
, selected :: String -- object
, "data" ::
Array Data
{"type" ::
Maybe
String
, show ::
Maybe
Boolean
, zlevel ::
Maybe
Number
, z ::
Maybe
Number
, left ::
Maybe
Number
, top ::
Maybe
Number
, right ::
Maybe
Number
, bottom ::
Maybe
Number
, width ::
Maybe
Number
, height ::
Maybe
Number
, orient ::
Maybe
String
, align ::
Maybe
String
, padding ::
Maybe
Number
, itemGap ::
Maybe
Number
, itemWidth ::
Maybe
Number
, itemHeight ::
Maybe
Number
, formatter ::
Maybe
String
, selectedMode ::
Maybe
Boolean
, inactiveColor ::
Maybe
Color
, selected ::
Maybe
String -- object
, "data" ::
Maybe (Array Data)
}
type Data =
{ name :: String
, icon :: String
, textStyle :: {}
, icon ::
Maybe
String
, textStyle ::
Maybe
{}
}
...
...
@@ -139,7 +140,7 @@ type Tooltip =
}
type XAxis =
{ "data" :: Array
String
{ "data" :: Array
Data
, "type" :: String
, axisTick :: AxisTick
}
...
...
@@ -203,10 +204,14 @@ type Rich = {}
foreign import eChartsClass :: forall props. R.ReactClass props
foreign import eChartsClass' :: forall props. R.ReactClass Option
echarts :: forall eff. Array Props -> R.ReactElement
echarts p = R.createElementDynamic eChartsClass (unsafeFromPropsArray p) []
echarts' :: forall eff. Option -> R.ReactElement
echarts' opt = R.createElementDynamic eChartsClass opt []
-- Props
loading :: Boolean -> Props
...
...
@@ -362,6 +367,69 @@ yAxisIndex = unsafeMkProps "yAxisIndex"
-- , p''
-- ]
legend' :: Maybe Legend
legend' = Just $
{
"type": Nothing
,show: Nothing
,zlevel: Nothing
, z : Nothing
, left : Nothing
, top : Nothing
, right : Nothing
, bottom: Nothing
, width : Nothing
, height: Nothing
, orient: Nothing
, align : Nothing
, padding : Nothing
, itemGap : Nothing
, itemWidth : Nothing
, itemHeight : Nothing
, formatter : Nothing
, selectedMode : Nothing
, inactiveColor: Nothing
, selected : Nothing
, "data" : [data1, data2, data3]
}
data1 :: Data
data1 = {name: "Map terms coverage", icon: Nothing, textStyle: Nothing}
data2 :: Data
data2 = {name: "Favorites", icon: Nothing, textStyle: Nothing}
data3 :: Data
data3 = {name: "All", icon: Nothing, textStyle: Nothing}
xAxis :: XAxis
xAxis =
{
}
opt :: Option
opt =
{
title: title'
,legend: legend'
,tooltip: tooltip'
,grid: grid'
,xAxis: xAxis'
,yAxis: yAxis'
,series: series'
,dataZoom: dataZoom'
}
where title' = Nothing
tooltip' = Nothing
grid' = Nothing
yAxis' = Nothing
series' = Nothing
dataZoom' = Nothing
histogram' :: R.ReactElement
histogram' = echarts []
histogram :: R.ReactElement
histogram = echarts
[ option
...
...
@@ -481,6 +549,19 @@ sd3 = unsafeFromPropsArray
, data' [201, 222, 223, 777, 244, 255, 555, 879, 938, 1364, 1806, 2324]
]
dataZoom' :: Array DataZoom -> Props
dataZoom' dzs = unsafeMkProps "dataZoom" $ dzToProps <$> dzs
dzToProps :: forall props. DataZoom -> props
dzToProps dz = unsafeFromPropsArray
[ type' dz."type"
, xAxisIndex dz.xAxisIndex
, filterMode dz.filterMode
, start dz.start
, end dz.end
]
sd2 :: forall props. props
sd2 = unsafeFromPropsArray
...
...
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