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

done testStyle and textWeight, working on align

parent c0af47ff
......@@ -97,7 +97,7 @@ series' =
opt :: Option
opt =
{
title: title'
title: title
,legend: Nothing
,tooltip: tooltip'
,grid: {containLabel: true}
......@@ -106,35 +106,43 @@ opt =
,series: [series']
,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
}
title :: Title
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: renderChartColor turquoise
,borderColor: renderChartColor violet
,borderWidth: 20.0
,borderRadius: Left 20.0
,shadowBlur: 40.0
,shadowColor: renderChartColor turquoise
,shadowOffsetX: 20.0
,shadowOffsetY: 40.0
}
textStyle :: ChartFontStyle
textStyle =
{
}
charts :: Echarts
charts =
......
......@@ -2,12 +2,10 @@ module Charts.Types where
import Unsafe.Coerce
import CSS (Color, toHexString)
import CSS (Color, FontStyle(..), Value(..), toHexString, Prefixed(..))
import Data.Either (Either)
import Data.Generic (class Generic, gShow)
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)
......@@ -17,17 +15,31 @@ instance showTopRelativePosition :: Show TopRelativePosition
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
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
renderCSSColor = CSSColor <<< toHexString
newtype ChartFontWeight = ChartFontWeight String
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
......@@ -90,12 +102,12 @@ type Title =
, top :: Position TopRelativePosition -- default 'auto'
, right :: Position Unit -- default 'auto'
, bottom :: Position Unit -- default 'auto'
, backgroundColor :: CSSColor -- default 'transparent''
, borderColor :: CSSColor -- default '#ccc'
, backgroundColor :: ChartColor -- default 'transparent''
, borderColor :: ChartColor -- default '#ccc'
, borderWidth :: Number -- default '1'
, borderRadius :: NumberOrArray -- default 0; data NumberOrArray = Number | Array Number
, shadowBlur :: Number
, shadowColor :: CSSColor
, shadowColor :: ChartColor
, shadowOffsetX :: Number
, shadowOffsetY :: Number
}
......@@ -151,12 +163,12 @@ type Data =
}
type SubtextStyle =
{ color :: Color
, fontStyle :: String
, fontWeight :: String
{ color :: ChartColor
, fontStyle :: ChartFontStyle
, fontWeight :: ChartFontWeight
, fontFamily :: String
, fontSize :: Int
, align :: String
, align :: LeftRelativePosition
, verticalAlign :: String
, lineHeight :: Number
, width :: Number
......@@ -216,14 +228,14 @@ type TextStyle =
, verticalAlign :: String
, lineHeight :: Int
, width :: Int
, height :: Int
, height :: Int
, textBorderColor :: String
, textBorderWidth :: Int
, textShadowColor :: String
, textShadowBlur :: Int
, textShadowBlur :: Int
, textShadowOffsetX :: Int
, textShadowOffsetY :: Int
, rich :: Rich
, rich :: Rich
}
type Rich = {}
......@@ -18,7 +18,7 @@ performAction :: forall eff props. PerformAction (dom :: DOM | eff) State props
performAction _ _ _ = pure unit
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 = 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