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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
c0af47ff
Commit
c0af47ff
authored
May 24, 2018
by
Mael NICOLAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nearly done with title
parent
6d4ec0f0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
149 additions
and
96 deletions
+149
-96
bower.json
bower.json
+65
-64
ECharts.purs
src/Charts/ECharts.purs
+35
-3
Types.purs
src/Charts/Types.purs
+49
-29
No files found.
bower.json
View file @
c0af47ff
...
@@ -64,3 +64,4 @@
...
@@ -64,3 +64,4 @@
"purescript-newtype"
:
"^2.0.0"
"purescript-newtype"
:
"^2.0.0"
}
}
}
}
src/Charts/ECharts.purs
View file @
c0af47ff
module Charts.ECharts where
module Charts.ECharts where
import CSS (Color)
import Charts.Types
import Data.Either
import CSS (Color, borderColor, toHexString, turquoise, violet, yellowgreen)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Prelude (show)
import React as R
import React as R
import React.DOM (p)
import React.DOM (p)
import React.DOM.Props (Props)
import React.DOM.Props (Props)
import Charts.Types
foreign import eChartsClass :: forall props. R.ReactClass props
foreign import eChartsClass :: forall props. R.ReactClass props
foreign import eChartsClass2 :: R.ReactClass Echarts
foreign import eChartsClass2 :: R.ReactClass Echarts
...
@@ -94,7 +97,7 @@ series' =
...
@@ -94,7 +97,7 @@ series' =
opt :: Option
opt :: Option
opt =
opt =
{
{
title:
Nothing
title:
title'
,legend: Nothing
,legend: Nothing
,tooltip: tooltip'
,tooltip: tooltip'
,grid: {containLabel: true}
,grid: {containLabel: true}
...
@@ -103,6 +106,35 @@ opt =
...
@@ -103,6 +106,35 @@ opt =
,series: [series']
,series: [series']
,dataZoom: [dz1', dz1', dz2', dz2']
,dataZoom: [dz1', dz1', dz2', dz2']
}
}
where title' =
{
id: ""
,show: true
,text: "MudaTitre rpz les pyramides"
,link: "https://google.com"
,target: "blank"
,textStyle: Nothing
,subtext: "Muda Subtitle"
,sublink: "https://google.fr"
,subtarget: "blank"
,subtextStyle: Nothing
,padding: 10.0
,itemGap: 0.0
,zlevel: 2.0
,z: 2.0
,left: renderLeftRelativePosition RightPos
,top: renderTopRelativePosition Middle
,right: renderNumber 60.0
,bottom: renderPercentage 40.0
,backgroundColor: renderCSSColor turquoise
,borderColor: renderCSSColor violet
,borderWidth: 20.0
,borderRadius: Left 20.0
,shadowBlur: 40.0
,shadowColor: renderCSSColor turquoise
,shadowOffsetX: 20.0
,shadowOffsetY: 40.0
}
charts :: Echarts
charts :: Echarts
charts =
charts =
...
...
src/Charts/Types.purs
View file @
c0af47ff
module Charts.Types where
module Charts.Types where
import
Prelude ((<>), show, ($))
import
Unsafe.Coerce
import Data.Maybe(Maybe)
import
Data.Either(Either
)
import
CSS (Color, toHexString
)
import Data.
String (toLow
er)
import Data.
Either (Eith
er)
import Data.Generic (class Generic, gShow)
import Data.Generic (class Generic, gShow)
import CSS (Color)
import Data.Maybe (Maybe)
import Data.String (toLower)
import Prelude ((<>), class Show, show, ($), (>>>), Unit, (<<<))
type NumberOrArray = Either Number (Array Number)
type NumberOrArray = Either Number (Array Number)
data Top = Top | Middle | Bottom
data TopRelativePosition = Top | Middle | Bottom
derive instance genericTop :: Generic Top
instance showTopRelativePosition :: Show TopRelativePosition
where show (Top) = "top"
show (Middle) = "middle"
show (Bottom) = "bottom"
data LeftRelativePosition = LeftPos | Center | RightPos
instance showLeftRelativePosition :: Show LeftRelativePosition
where show (LeftPos) = "left"
show (Center) = "center"
show (RightPos) = "right"
newtype CSSColor = CSSColor String
renderCSSColor :: Color -> CSSColor
renderCSSColor = CSSColor <<< toHexString
foreign import data Position :: Type -> Type
renderNumber :: forall r. Number -> Position r
renderNumber = unsafeCoerce
data Position relative = Flat Number | Percent Number | Relative relative -- 20 | 20% | top
renderPercentage :: forall r. Number -> Position r
renderPercentage n = unsafeCoerce $ (show n) <> "%"
class InitialB r
renderTopRelativePosition :: TopRelativePosition -> Position TopRelativePosition
instance nightOfNumber :: InitialB Number
renderTopRelativePosition = unsafeCoerce <<< show
instance runningInTheString :: InitialB String
displayTopPosition :: forall a. InitialB a => Position Top -> a
renderLeftRelativePosition :: LeftRelativePosition -> Position LeftRelativePosition
displayTopPosition (Flat n) = n
renderLeftRelativePosition = unsafeCoerce <<< show
displayTopPosition (Percent n) = (show n) <> "%"
displayTopPosition (Relative r) = toLower $ gShow r
type Echarts =
type Echarts =
{ className :: Maybe String,
{ className :: Maybe String,
...
@@ -40,7 +60,7 @@ type Echarts =
...
@@ -40,7 +60,7 @@ type Echarts =
}
}
type Option =
type Option =
{ title ::
Maybe
Title
{ title :: Title
, legend :: Maybe Legend
, legend :: Maybe Legend
, tooltip :: Tooltip
, tooltip :: Tooltip
, grid :: Grid
, grid :: Grid
...
@@ -52,30 +72,30 @@ type Option =
...
@@ -52,30 +72,30 @@ type Option =
type Title =
type Title =
{
{
id ::
Maybe String
id ::
String -- None by default
, show :: Boolean -- default True
, show :: Boolean -- default True
, text ::
Maybe
String -- default ''
, text :: String -- default ''
, link ::
Maybe
String -- default ''
, link :: String -- default ''
, target :: String -- default 'blank'
, target :: String -- default 'blank'
, textStyle :: TextStyle
, textStyle ::
Maybe
TextStyle
, subtext :: String -- default ''
, subtext :: String -- default ''
, sublink :: String -- default ''
, sublink :: String -- default ''
, subtarget :: String -- default 'blank'
, subtarget :: String -- default 'blank'
, subtextStyle :: SubtextStyle
, subtextStyle ::
Maybe
SubtextStyle
, padding :: Number -- default '5'
, padding :: Number -- default '5'
, itemGap :: Number -- default '10'
, itemGap :: Number -- default '10'
, zlevel :: Number -- default '0'
, zlevel :: Number -- default '0'
, z :: Number -- default '2'
, z :: Number -- default '2'
, left ::
Number
-- default 'auto'
, left ::
Position LeftRelativePosition
-- default 'auto'
, top ::
Number
-- default 'auto'
, top ::
Position TopRelativePosition
-- default 'auto'
, right ::
Number
-- default 'auto'
, right ::
Position Unit
-- default 'auto'
, bottom ::
Number
-- default 'auto'
, bottom ::
Position Unit
-- default 'auto'
, backgroundColor :: Color -- default 'transparent''
, backgroundColor :: C
SSC
olor -- default 'transparent''
, borderColor :: Color -- default '#ccc'
, borderColor :: C
SSC
olor -- default '#ccc'
, borderWidth :: Number -- default '1'
, borderWidth :: Number -- default '1'
, borderRadius :: Number -- default 0; data NumberOrArray = Number | Array Number
, borderRadius :: Number
OrArray
-- default 0; data NumberOrArray = Number | Array Number
, shadowBlur :: Number
, shadowBlur :: Number
, shadowColor :: Color
, shadowColor :: C
SSC
olor
, shadowOffsetX :: Number
, shadowOffsetX :: Number
, shadowOffsetY :: Number
, shadowOffsetY :: Number
}
}
...
...
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