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
...
@@ -3,9 +3,10 @@ module Charts.ECharts where
import Charts.Types
import Charts.Types
import Data.Either
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 Data.Maybe (Maybe(..))
import Prelude (show)
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)
...
@@ -115,33 +116,70 @@ title =
...
@@ -115,33 +116,70 @@ title =
,text: "MudaTitre rpz les pyramides"
,text: "MudaTitre rpz les pyramides"
,link: "https://google.com"
,link: "https://google.com"
,target: "blank"
,target: "blank"
,textStyle:
Nothing
,textStyle:
textStyle
,subtext: "Muda Subtitle"
,subtext: "Muda Subtitle"
,sublink: "https://google.fr"
,sublink: "https://google.fr"
,subtarget: "blank"
,subtarget: "blank"
,subtextStyle:
Nothing
,subtextStyle:
textStyle2
,padding: 10.0
,padding: 10.0
,itemGap: 0.0
,itemGap: 0.0
,zlevel: 2.0
,zlevel: 2.0
,z: 2.0
,z: 2.0
,left: render
LeftRelativePosition RightPos
,left: render
RelativePosition (Relative Center)
,top: render
TopRelativePosition Middle
,top: render
RelativePosition (Relative Middle)
,right: renderNumber 60.0
,right: renderNumber 60.0
,bottom: renderPercentage 40.0
,bottom: renderPercentage 40.0
,backgroundColor: renderChartColor
turquoise
,backgroundColor: renderChartColor
black
,borderColor: renderChartColor
violet
,borderColor: renderChartColor
black
,borderWidth:
2
0.0
,borderWidth: 0.0
,borderRadius: Left 20.0
,borderRadius: Left 20.0
,shadowBlur:
4
0.0
,shadowBlur: 0.0
,shadowColor: renderChartColor
turquoise
,shadowColor: renderChartColor
black
,shadowOffsetX:
2
0.0
,shadowOffsetX: 0.0
,shadowOffsetY:
4
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 =
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
charts :: Echarts
...
@@ -185,7 +223,7 @@ histogram = echarts
...
@@ -185,7 +223,7 @@ histogram = echarts
, yAxis [ya1, ya2]
, yAxis [ya1, ya2]
, series [sd1, sd2, sd3]
, series [sd1, sd2, sd3]
]
]
]
j
]
type DataZoom =
type DataZoom =
{"type" :: String
{"type" :: String
...
...
src/Charts/Types.purs
View file @
ce9e14d5
...
@@ -2,7 +2,7 @@ module Charts.Types where
...
@@ -2,7 +2,7 @@ module Charts.Types where
import Unsafe.Coerce
import Unsafe.Coerce
import CSS (Color, FontStyle(..),
Value(..), toHexString, Prefixed(..)
)
import CSS (Color, FontStyle(..),
FontWeight(..), Prefixed(..), Value(..), toHexString
)
import Data.Either (Either)
import Data.Either (Either)
import Data.Maybe (Maybe)
import Data.Maybe (Maybe)
import Prelude ((<>), class Show, show, ($), Unit, (<<<))
import Prelude ((<>), class Show, show, ($), Unit, (<<<))
...
@@ -21,6 +21,10 @@ instance showLeftRelativePosition :: Show LeftRelativePosition
...
@@ -21,6 +21,10 @@ instance showLeftRelativePosition :: Show LeftRelativePosition
show (Center) = "center"
show (Center) = "center"
show (RightPos) = "right"
show (RightPos) = "right"
data Align p = Auto | Relative p
newtype ChartAlign = ChartAlign String
newtype ChartColor = ChartColor String
newtype ChartColor = ChartColor String
renderChartColor :: Color -> ChartColor
renderChartColor :: Color -> ChartColor
...
@@ -36,10 +40,10 @@ renderChartFontStyle _ = ChartFontStyle "normal"
...
@@ -36,10 +40,10 @@ renderChartFontStyle _ = ChartFontStyle "normal"
newtype ChartFontWeight = ChartFontWeight String
newtype ChartFontWeight = ChartFontWeight String
renderChartFontWeight :: FontWeight -> ChartFontWeight
renderChartFontWeight :: FontWeight -> ChartFontWeight
renderChartFontWeight (Font
Style (Value (Plain "bold")
))) = ChartFontWeight "bold"
renderChartFontWeight (Font
Weight (Value (Plain "bold"
))) = ChartFontWeight "bold"
renderChartFontWeight (Font
Style (Value (Plain "bolder")
))) = ChartFontWeight "bolder"
renderChartFontWeight (Font
Weight (Value (Plain "bolder"
))) = ChartFontWeight "bolder"
renderChartFontWeight (Font
Style (Value (Plain "lighter")
))) = ChartFontWeight "lighter"
renderChartFontWeight (Font
Weight (Value (Plain "lighter"
))) = ChartFontWeight "lighter"
renderChartFontWeight _ = ChartFontWeight "normal"
renderChartFontWeight
_ = ChartFontWeight "normal"
foreign import data Position :: Type -> Type
foreign import data Position :: Type -> Type
...
@@ -49,11 +53,9 @@ renderNumber = unsafeCoerce
...
@@ -49,11 +53,9 @@ renderNumber = unsafeCoerce
renderPercentage :: forall r. Number -> Position r
renderPercentage :: forall r. Number -> Position r
renderPercentage n = unsafeCoerce $ (show n) <> "%"
renderPercentage n = unsafeCoerce $ (show n) <> "%"
renderTopRelativePosition :: TopRelativePosition -> Position TopRelativePosition
renderRelativePosition :: forall a. Show a => Align a -> Position a
renderTopRelativePosition = unsafeCoerce <<< show
renderRelativePosition (Auto) = unsafeCoerce "auto"
renderRelativePosition (Relative r) = unsafeCoerce $ show r
renderLeftRelativePosition :: LeftRelativePosition -> Position LeftRelativePosition
renderLeftRelativePosition = unsafeCoerce <<< show
type Echarts =
type Echarts =
{ className :: Maybe String,
{ className :: Maybe String,
...
@@ -89,11 +91,11 @@ type Title =
...
@@ -89,11 +91,11 @@ type Title =
, text :: String -- default ''
, text :: String -- default ''
, link :: String -- default ''
, link :: String -- default ''
, target :: String -- default 'blank'
, target :: String -- default 'blank'
, textStyle ::
Maybe
TextStyle
, textStyle :: TextStyle
, subtext :: String -- default ''
, subtext :: String -- default ''
, sublink :: String -- default ''
, sublink :: String -- default ''
, subtarget :: String -- default 'blank'
, subtarget :: String -- default 'blank'
, subtextStyle ::
Maybe Subt
extStyle
, subtextStyle ::
T
extStyle
, padding :: Number -- default '5'
, padding :: Number -- default '5'
, itemGap :: Number -- default '10'
, itemGap :: Number -- default '10'
, zlevel :: Number -- default '0'
, zlevel :: Number -- default '0'
...
@@ -162,24 +164,23 @@ type Data =
...
@@ -162,24 +164,23 @@ type Data =
, textStyle :: Maybe {}
, textStyle :: Maybe {}
}
}
type
Subt
extStyle =
type
T
extStyle =
{ color :: ChartColor
{ color :: ChartColor
, fontStyle :: ChartFontStyle
, fontStyle :: ChartFontStyle
, fontWeight :: ChartFontWeight
, fontWeight :: ChartFontWeight
, fontFamily :: String
, fontFamily :: String
, fontSize :: Int
, fontSize :: Int
, align :: LeftRelativePosition
, align ::
Position
LeftRelativePosition
, verticalAlign ::
String
, verticalAlign ::
Position TopRelativePosition
, lineHeight ::
Number
, lineHeight ::
Position Unit
, width ::
Number
, width ::
Position Unit
, height ::
Number
, height ::
Position Unit
, textBorderColor ::
String
, textBorderColor ::
ChartColor
, textBorderWidth :: Number
, textBorderWidth :: Number
, textShadowColor ::
String
, textShadowColor ::
ChartColor
, textShadowBlur ::
Numbe
r
, textShadowBlur ::
ChartColo
r
, textShadowOffsetX :: Number
, textShadowOffsetX :: Number
, textShadowOffsetY :: Number
, textShadowOffsetY :: Number
, rich :: Rich
}
}
type Tooltip =
type Tooltip =
...
@@ -216,26 +217,4 @@ type Series =
...
@@ -216,26 +217,4 @@ type Series =
, "data" :: Array Int
, "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 = {}
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