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
Show 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
...
@@ -3,10 +3,11 @@ module Chart where
import Prelude
import Prelude
import CSS (Color, white)
import CSS (Color, white)
import
React.DOM.Props (Props, unsafeFromPropsArray, unsafeMkProps
)
import
Data.Maybe (Maybe(..)
)
import React as R
import React as R
import React.DOM (p)
import React.DOM (p)
import React.DOM.Props (Props, className, unsafeFromPropsArray)
import React.DOM.Props (Props, className, unsafeFromPropsArray)
import React.DOM.Props (Props, unsafeFromPropsArray, unsafeMkProps)
import ReactDOM as RDOM
import ReactDOM as RDOM
import Thermite (Render, Spec, createReactSpec, defaultPerformAction, simpleSpec)
import Thermite (Render, Spec, createReactSpec, defaultPerformAction, simpleSpec)
...
@@ -57,14 +58,14 @@ type OptsLoading =
...
@@ -57,14 +58,14 @@ type OptsLoading =
}
}
type Option =
type Option =
{ title :: Title
{ title ::
Maybe
Title
, legend :: Legend
, legend ::
Maybe
Legend
, tooltip :: Tooltip
, tooltip ::
Maybe
Tooltip
, grid :: Grid
, grid ::
Maybe
Grid
, xAxis :: Array XAxis
, xAxis ::
Maybe
Array XAxis
, yAxis :: Array YAxis
, yAxis ::
Maybe
Array YAxis
, series :: Array Series
, series ::
Maybe
Array Series
, dataZoom :: Array DataZoom
, dataZoom ::
Maybe
Array DataZoom
}
}
...
@@ -81,33 +82,33 @@ type Grid =
...
@@ -81,33 +82,33 @@ type Grid =
}
}
type Legend =
type Legend =
{"type" :: String
{"type" ::
Maybe
String
, show :: Boolean
, show ::
Maybe
Boolean
, zlevel :: Number
, zlevel ::
Maybe
Number
, z :: Number
, z ::
Maybe
Number
, left :: Number
, left ::
Maybe
Number
, top :: Number
, top ::
Maybe
Number
, right :: Number
, right ::
Maybe
Number
, bottom :: Number
, bottom ::
Maybe
Number
, width :: Number
, width ::
Maybe
Number
, height :: Number
, height ::
Maybe
Number
, orient :: String
, orient ::
Maybe
String
, align :: String
, align ::
Maybe
String
, padding :: Number
, padding ::
Maybe
Number
, itemGap :: Number
, itemGap ::
Maybe
Number
, itemWidth :: Number
, itemWidth ::
Maybe
Number
, itemHeight :: Number
, itemHeight ::
Maybe
Number
, formatter :: String
, formatter ::
Maybe
String
, selectedMode :: Boolean
, selectedMode ::
Maybe
Boolean
, inactiveColor :: Color
, inactiveColor ::
Maybe
Color
, selected :: String -- object
, selected ::
Maybe
String -- object
, "data" ::
Array Data
, "data" ::
Maybe (Array Data)
}
}
type Data =
type Data =
{ name :: String
{ name :: String
, icon :: String
, icon ::
Maybe
String
, textStyle :: {}
, textStyle ::
Maybe
{}
}
}
...
@@ -139,7 +140,7 @@ type Tooltip =
...
@@ -139,7 +140,7 @@ type Tooltip =
}
}
type XAxis =
type XAxis =
{ "data" :: Array
String
{ "data" :: Array
Data
, "type" :: String
, "type" :: String
, axisTick :: AxisTick
, axisTick :: AxisTick
}
}
...
@@ -203,10 +204,14 @@ type Rich = {}
...
@@ -203,10 +204,14 @@ type Rich = {}
foreign import eChartsClass :: forall props. R.ReactClass props
foreign import eChartsClass :: forall props. R.ReactClass props
foreign import eChartsClass' :: forall props. R.ReactClass Option
echarts :: forall eff. Array Props -> R.ReactElement
echarts :: forall eff. Array Props -> R.ReactElement
echarts p = R.createElementDynamic eChartsClass (unsafeFromPropsArray p) []
echarts p = R.createElementDynamic eChartsClass (unsafeFromPropsArray p) []
echarts' :: forall eff. Option -> R.ReactElement
echarts' opt = R.createElementDynamic eChartsClass opt []
-- Props
-- Props
loading :: Boolean -> Props
loading :: Boolean -> Props
...
@@ -362,6 +367,69 @@ yAxisIndex = unsafeMkProps "yAxisIndex"
...
@@ -362,6 +367,69 @@ yAxisIndex = unsafeMkProps "yAxisIndex"
-- , p''
-- , 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 :: R.ReactElement
histogram = echarts
histogram = echarts
[ option
[ option
...
@@ -481,6 +549,19 @@ sd3 = unsafeFromPropsArray
...
@@ -481,6 +549,19 @@ sd3 = unsafeFromPropsArray
, data' [201, 222, 223, 777, 244, 255, 555, 879, 938, 1364, 1806, 2324]
, 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 :: forall props. props
sd2 = unsafeFromPropsArray
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