Commit 3f10486e authored by Mael NICOLAS's avatar Mael NICOLAS

done testStyle and textWeight, working on align

parent c0af47ff
...@@ -97,7 +97,7 @@ series' = ...@@ -97,7 +97,7 @@ series' =
opt :: Option opt :: Option
opt = opt =
{ {
title: title' title: title
,legend: Nothing ,legend: Nothing
,tooltip: tooltip' ,tooltip: tooltip'
,grid: {containLabel: true} ,grid: {containLabel: true}
...@@ -106,35 +106,43 @@ opt = ...@@ -106,35 +106,43 @@ opt =
,series: [series'] ,series: [series']
,dataZoom: [dz1', dz1', dz2', dz2'] ,dataZoom: [dz1', dz1', dz2', dz2']
} }
where title' =
{ title :: Title
id: "" title =
,show: true {
,text: "MudaTitre rpz les pyramides" id: ""
,link: "https://google.com" ,show: true
,target: "blank" ,text: "MudaTitre rpz les pyramides"
,textStyle: Nothing ,link: "https://google.com"
,subtext: "Muda Subtitle" ,target: "blank"
,sublink: "https://google.fr" ,textStyle: Nothing
,subtarget: "blank" ,subtext: "Muda Subtitle"
,subtextStyle: Nothing ,sublink: "https://google.fr"
,padding: 10.0 ,subtarget: "blank"
,itemGap: 0.0 ,subtextStyle: Nothing
,zlevel: 2.0 ,padding: 10.0
,z: 2.0 ,itemGap: 0.0
,left: renderLeftRelativePosition RightPos ,zlevel: 2.0
,top: renderTopRelativePosition Middle ,z: 2.0
,right: renderNumber 60.0 ,left: renderLeftRelativePosition RightPos
,bottom: renderPercentage 40.0 ,top: renderTopRelativePosition Middle
,backgroundColor: renderCSSColor turquoise ,right: renderNumber 60.0
,borderColor: renderCSSColor violet ,bottom: renderPercentage 40.0
,borderWidth: 20.0 ,backgroundColor: renderChartColor turquoise
,borderRadius: Left 20.0 ,borderColor: renderChartColor violet
,shadowBlur: 40.0 ,borderWidth: 20.0
,shadowColor: renderCSSColor turquoise ,borderRadius: Left 20.0
,shadowOffsetX: 20.0 ,shadowBlur: 40.0
,shadowOffsetY: 40.0 ,shadowColor: renderChartColor turquoise
} ,shadowOffsetX: 20.0
,shadowOffsetY: 40.0
}
textStyle :: ChartFontStyle
textStyle =
{
}
charts :: Echarts charts :: Echarts
charts = charts =
......
...@@ -2,12 +2,10 @@ module Charts.Types where ...@@ -2,12 +2,10 @@ module Charts.Types where
import Unsafe.Coerce import Unsafe.Coerce
import CSS (Color, toHexString) import CSS (Color, FontStyle(..), Value(..), toHexString, Prefixed(..))
import Data.Either (Either) import Data.Either (Either)
import Data.Generic (class Generic, gShow)
import Data.Maybe (Maybe) import Data.Maybe (Maybe)
import Data.String (toLower) import Prelude ((<>), class Show, show, ($), Unit, (<<<))
import Prelude ((<>), class Show, show, ($), (>>>), Unit, (<<<))
type NumberOrArray = Either Number (Array Number) type NumberOrArray = Either Number (Array Number)
...@@ -17,17 +15,31 @@ instance showTopRelativePosition :: Show TopRelativePosition ...@@ -17,17 +15,31 @@ instance showTopRelativePosition :: Show TopRelativePosition
show (Middle) = "middle" show (Middle) = "middle"
show (Bottom) = "bottom" show (Bottom) = "bottom"
data LeftRelativePosition = LeftPos | Center | RightPos data LeftRelativePosition = LeftPos | Center | RightPos
instance showLeftRelativePosition :: Show LeftRelativePosition instance showLeftRelativePosition :: Show LeftRelativePosition
where show (LeftPos) = "left" where show (LeftPos) = "left"
show (Center) = "center" show (Center) = "center"
show (RightPos) = "right" show (RightPos) = "right"
newtype CSSColor = CSSColor String newtype ChartColor = ChartColor String
renderChartColor :: Color -> ChartColor
renderChartColor = ChartColor <<< toHexString
newtype ChartFontStyle = ChartFontStyle String
renderChartFontStyle :: FontStyle -> ChartFontStyle
renderChartFontStyle (FontStyle (Value (Plain "italic"))) = ChartFontStyle "italic"
renderChartFontStyle (FontStyle (Value (Plain "oblique"))) = ChartFontStyle "oblique"
renderChartFontStyle _ = ChartFontStyle "normal"
renderCSSColor :: Color -> CSSColor newtype ChartFontWeight = ChartFontWeight String
renderCSSColor = CSSColor <<< toHexString
renderChartFontWeight :: FontWeight -> ChartFontWeight
renderChartFontWeight (FontStyle (Value (Plain "bold")))) = ChartFontWeight "bold"
renderChartFontWeight (FontStyle (Value (Plain "bolder")))) = ChartFontWeight "bolder"
renderChartFontWeight (FontStyle (Value (Plain "lighter")))) = ChartFontWeight "lighter"
renderChartFontWeight _ = ChartFontWeight "normal"
foreign import data Position :: Type -> Type foreign import data Position :: Type -> Type
...@@ -90,12 +102,12 @@ type Title = ...@@ -90,12 +102,12 @@ type Title =
, top :: Position TopRelativePosition -- default 'auto' , top :: Position TopRelativePosition -- default 'auto'
, right :: Position Unit -- default 'auto' , right :: Position Unit -- default 'auto'
, bottom :: Position Unit -- default 'auto' , bottom :: Position Unit -- default 'auto'
, backgroundColor :: CSSColor -- default 'transparent'' , backgroundColor :: ChartColor -- default 'transparent''
, borderColor :: CSSColor -- default '#ccc' , borderColor :: ChartColor -- default '#ccc'
, borderWidth :: Number -- default '1' , borderWidth :: Number -- default '1'
, borderRadius :: NumberOrArray -- default 0; data NumberOrArray = Number | Array Number , borderRadius :: NumberOrArray -- default 0; data NumberOrArray = Number | Array Number
, shadowBlur :: Number , shadowBlur :: Number
, shadowColor :: CSSColor , shadowColor :: ChartColor
, shadowOffsetX :: Number , shadowOffsetX :: Number
, shadowOffsetY :: Number , shadowOffsetY :: Number
} }
...@@ -151,12 +163,12 @@ type Data = ...@@ -151,12 +163,12 @@ type Data =
} }
type SubtextStyle = type SubtextStyle =
{ color :: Color { color :: ChartColor
, fontStyle :: String , fontStyle :: ChartFontStyle
, fontWeight :: String , fontWeight :: ChartFontWeight
, fontFamily :: String , fontFamily :: String
, fontSize :: Int , fontSize :: Int
, align :: String , align :: LeftRelativePosition
, verticalAlign :: String , verticalAlign :: String
, lineHeight :: Number , lineHeight :: Number
, width :: Number , width :: Number
...@@ -216,14 +228,14 @@ type TextStyle = ...@@ -216,14 +228,14 @@ type TextStyle =
, verticalAlign :: String , verticalAlign :: String
, lineHeight :: Int , lineHeight :: Int
, width :: Int , width :: Int
, height :: Int , height :: Int
, textBorderColor :: String , textBorderColor :: String
, textBorderWidth :: Int , textBorderWidth :: Int
, textShadowColor :: String , textShadowColor :: String
, textShadowBlur :: Int , textShadowBlur :: Int
, textShadowOffsetX :: Int , textShadowOffsetX :: Int
, textShadowOffsetY :: Int , textShadowOffsetY :: Int
, rich :: Rich , rich :: Rich
} }
type Rich = {} type Rich = {}
...@@ -18,7 +18,7 @@ performAction :: forall eff props. PerformAction (dom :: DOM | eff) State props ...@@ -18,7 +18,7 @@ performAction :: forall eff props. PerformAction (dom :: DOM | eff) State props
performAction _ _ _ = pure unit performAction _ _ _ = pure unit
render :: forall props. Render State props Action render :: forall props. Render State props Action
render dispatch _ state _ = [text "Dashboard", histogram2] render dispatch _ state _ = [histogram2]
layoutDashboard :: forall props eff. Spec (dom :: DOM | eff) State props Action layoutDashboard :: forall props eff. Spec (dom :: DOM | eff) State props Action
layoutDashboard = simpleSpec performAction render layoutDashboard = simpleSpec performAction render
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment