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
ce9e14d5
Commit
ce9e14d5
authored
May 25, 2018
by
Mael NICOLAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OK, Title done, didn't did rich to long and complicated
parent
3f10486e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
60 deletions
+77
-60
ECharts.purs
src/Charts/ECharts.purs
+54
-16
Types.purs
src/Charts/Types.purs
+23
-44
No files found.
src/Charts/ECharts.purs
View file @
ce9e14d5
...
...
@@ -3,9 +3,10 @@ module Charts.ECharts where
import Charts.Types
import Data.Either
import CSS (Color, borderColor, toHexString, turquoise, violet, yellowgreen)
import CSS (Color, black, blue, blueviolet, bolder, borderColor, fontWeight, green, italic, toHexString, turquoise, violet, white, yellow, yellowgreen)
import CSS.Common (class Bottom, normal)
import Data.Maybe (Maybe(..))
import Prelude (show)
import Prelude (show
, ($)
)
import React as R
import React.DOM (p)
import React.DOM.Props (Props)
...
...
@@ -115,33 +116,70 @@ title =
,text: "MudaTitre rpz les pyramides"
,link: "https://google.com"
,target: "blank"
,textStyle:
Nothing
,textStyle:
textStyle
,subtext: "Muda Subtitle"
,sublink: "https://google.fr"
,subtarget: "blank"
,subtextStyle:
Nothing
,subtextStyle:
textStyle2
,padding: 10.0
,itemGap: 0.0
,zlevel: 2.0
,z: 2.0
,left: render
LeftRelativePosition RightPos
,top: render
TopRelativePosition Middle
,left: render
RelativePosition (Relative Center)
,top: render
RelativePosition (Relative Middle)
,right: renderNumber 60.0
,bottom: renderPercentage 40.0
,backgroundColor: renderChartColor
turquoise
,borderColor: renderChartColor
violet
,borderWidth:
2
0.0
,backgroundColor: renderChartColor
black
,borderColor: renderChartColor
black
,borderWidth: 0.0
,borderRadius: Left 20.0
,shadowBlur:
4
0.0
,shadowColor: renderChartColor
turquoise
,shadowOffsetX:
2
0.0
,shadowOffsetY:
4
0.0
,shadowBlur: 0.0
,shadowColor: renderChartColor
black
,shadowOffsetX: 0.0
,shadowOffsetY: 0.0
}
textStyle :: ChartFontStyle
textStyle2 :: TextStyle
textStyle2 =
{
color: renderChartColor yellow
,fontStyle: renderChartFontStyle normal
,fontWeight: renderChartFontWeight normal
,fontFamily: "sans-serif"
,fontSize: 12
,align: renderRelativePosition $ Relative RightPos
,verticalAlign: renderRelativePosition $ Relative Bottom
,lineHeight: renderPercentage 0.0
,width: renderPercentage 100.0
,height: renderPercentage 100.0
,textBorderColor: renderChartColor blue
,textBorderWidth: 5.0
,textShadowColor: renderChartColor black
,textShadowBlur: renderChartColor black
,textShadowOffsetX: 0.0
,textShadowOffsetY: 0.0
}
textStyle :: TextStyle
textStyle =
{
color: renderChartColor white
,fontStyle: renderChartFontStyle normal
,fontWeight: renderChartFontWeight normal
,fontFamily: "sans-serif"
,fontSize: 12
,align: renderRelativePosition $ Relative LeftPos
,verticalAlign: renderRelativePosition $ Relative Top
,lineHeight: renderPercentage 0.0
,width: renderPercentage 100.0
,height: renderPercentage 100.0
,textBorderColor: renderChartColor blue
,textBorderWidth: 5.0
,textShadowColor: renderChartColor black
,textShadowBlur: renderChartColor black
,textShadowOffsetX: 0.0
,textShadowOffsetY: 0.0
}
charts :: Echarts
...
...
@@ -185,7 +223,7 @@ histogram = echarts
, yAxis [ya1, ya2]
, series [sd1, sd2, sd3]
]
]
j
]
type DataZoom =
{"type" :: String
...
...
src/Charts/Types.purs
View file @
ce9e14d5
...
...
@@ -2,7 +2,7 @@ module Charts.Types where
import Unsafe.Coerce
import CSS (Color, FontStyle(..),
Value(..), toHexString, Prefixed(..)
)
import CSS (Color, FontStyle(..),
FontWeight(..), Prefixed(..), Value(..), toHexString
)
import Data.Either (Either)
import Data.Maybe (Maybe)
import Prelude ((<>), class Show, show, ($), Unit, (<<<))
...
...
@@ -21,6 +21,10 @@ instance showLeftRelativePosition :: Show LeftRelativePosition
show (Center) = "center"
show (RightPos) = "right"
data Align p = Auto | Relative p
newtype ChartAlign = ChartAlign String
newtype ChartColor = ChartColor String
renderChartColor :: Color -> ChartColor
...
...
@@ -36,10 +40,10 @@ renderChartFontStyle _ = ChartFontStyle "normal"
newtype ChartFontWeight = ChartFontWeight String
renderChartFontWeight :: FontWeight -> ChartFontWeight
renderChartFontWeight (Font
Style (Value (Plain "bold")
))) = ChartFontWeight "bold"
renderChartFontWeight (Font
Style (Value (Plain "bolder")
))) = ChartFontWeight "bolder"
renderChartFontWeight (Font
Style (Value (Plain "lighter")
))) = ChartFontWeight "lighter"
renderChartFontWeight _ = ChartFontWeight "normal"
renderChartFontWeight (Font
Weight (Value (Plain "bold"
))) = ChartFontWeight "bold"
renderChartFontWeight (Font
Weight (Value (Plain "bolder"
))) = ChartFontWeight "bolder"
renderChartFontWeight (Font
Weight (Value (Plain "lighter"
))) = ChartFontWeight "lighter"
renderChartFontWeight
_ = ChartFontWeight "normal"
foreign import data Position :: Type -> Type
...
...
@@ -49,11 +53,9 @@ renderNumber = unsafeCoerce
renderPercentage :: forall r. Number -> Position r
renderPercentage n = unsafeCoerce $ (show n) <> "%"
renderTopRelativePosition :: TopRelativePosition -> Position TopRelativePosition
renderTopRelativePosition = unsafeCoerce <<< show
renderLeftRelativePosition :: LeftRelativePosition -> Position LeftRelativePosition
renderLeftRelativePosition = unsafeCoerce <<< show
renderRelativePosition :: forall a. Show a => Align a -> Position a
renderRelativePosition (Auto) = unsafeCoerce "auto"
renderRelativePosition (Relative r) = unsafeCoerce $ show r
type Echarts =
{ className :: Maybe String,
...
...
@@ -89,11 +91,11 @@ type Title =
, text :: String -- default ''
, link :: String -- default ''
, target :: String -- default 'blank'
, textStyle ::
Maybe
TextStyle
, textStyle :: TextStyle
, subtext :: String -- default ''
, sublink :: String -- default ''
, subtarget :: String -- default 'blank'
, subtextStyle ::
Maybe Subt
extStyle
, subtextStyle ::
T
extStyle
, padding :: Number -- default '5'
, itemGap :: Number -- default '10'
, zlevel :: Number -- default '0'
...
...
@@ -162,24 +164,23 @@ type Data =
, textStyle :: Maybe {}
}
type
Subt
extStyle =
type
T
extStyle =
{ color :: ChartColor
, fontStyle :: ChartFontStyle
, fontWeight :: ChartFontWeight
, fontFamily :: String
, fontSize :: Int
, align :: LeftRelativePosition
, verticalAlign ::
String
, lineHeight ::
Number
, width ::
Number
, height ::
Number
, textBorderColor ::
String
, align ::
Position
LeftRelativePosition
, verticalAlign ::
Position TopRelativePosition
, lineHeight ::
Position Unit
, width ::
Position Unit
, height ::
Position Unit
, textBorderColor ::
ChartColor
, textBorderWidth :: Number
, textShadowColor ::
String
, textShadowBlur ::
Numbe
r
, textShadowColor ::
ChartColor
, textShadowBlur ::
ChartColo
r
, textShadowOffsetX :: Number
, textShadowOffsetY :: Number
, rich :: Rich
}
type Tooltip =
...
...
@@ -216,26 +217,4 @@ type Series =
, "data" :: Array Int
}
-- Props
type TextStyle =
{ color :: Color
, fontStyle :: String
, fontWeight :: String
, fontFamily :: String
, fontSize :: Int
, align :: String
, verticalAlign :: String
, lineHeight :: Int
, width :: Int
, height :: Int
, textBorderColor :: String
, textBorderWidth :: Int
, textShadowColor :: String
, textShadowBlur :: Int
, textShadowOffsetX :: Int
, textShadowOffsetY :: Int
, rich :: Rich
}
type Rich = {}
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