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
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
gargantext
purescript-gargantext
Commits
1e9c64d6
Commit
1e9c64d6
authored
May 29, 2018
by
Mael NICOLAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hiding constructor, renaming and start to implement Legend
parent
033c721e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
124 additions
and
74 deletions
+124
-74
Color.purs
src/Charts/Color.purs
+7
-3
ECharts.js
src/Charts/ECharts.js
+0
-1
ECharts.purs
src/Charts/ECharts.purs
+36
-37
Font.purs
src/Charts/Font.purs
+16
-10
Legend.purs
src/Charts/Legend.purs
+30
-0
Position.purs
src/Charts/Position.purs
+10
-2
Type.purs
src/Charts/Type.purs
+25
-21
No files found.
src/Charts/Color.purs
View file @
1e9c64d6
module Charts.Color where
module Charts.Color
(
ChartColor(),
chartColor
)where
import Prelude ((<<<))
import CSS (Color, toHexString)
newtype ChartColor = ChartColor String
renderC
hartColor :: Color -> ChartColor
renderC
hartColor = ChartColor <<< toHexString
c
hartColor :: Color -> ChartColor
c
hartColor = ChartColor <<< toHexString
src/Charts/ECharts.js
View file @
1e9c64d6
...
...
@@ -3,4 +3,3 @@
var
ReactEcharts
=
require
(
"echarts-for-react"
);
exports
.
eChartsClass
=
ReactEcharts
.
default
;
exports
.
eChartsClass2
=
ReactEcharts
.
default
;
src/Charts/ECharts.purs
View file @
1e9c64d6
module Charts.ECharts where
import CSS (black, blue, white, yellow)
import CSS.Common (normal)
import Charts.Color (chartColor)
import Charts.Font (chartFontStyle, chartFontWeight)
import Charts.Legend (legendType, LegendType, PlainOrScroll(..))
import Charts.Position (Align(..), LeftRelativePosition(..), TopRelativePosition(..), numberPosition, percentPosition, relativePosition)
import Charts.Type (Data, DataZoom, Echarts, Legend, Option, Series, TextStyle, Title, Tooltip, XAxis, YAxis)
import Data.Either (Either(..))
import Data.Maybe (Maybe(..))
import Prelude (($))
import Charts.Type (Data, DataZoom, Echarts, Legend, Option, Series, TextStyle, Title, Tooltip, XAxis, YAxis)
import Charts.Color (renderChartColor)
import Charts.Font (renderChartFontStyle, renderChartFontWeight)
import Charts.Position (Align(..), LeftRelativePosition(..), TopRelativePosition(..), numberPosition, percentPosition, relativePosition)
import CSS (black, blue, white, yellow)
import CSS.Common (normal)
import React as R
import React.DOM (p)
foreign import eChartsClass :: forall props. R.ReactClass props
foreign import eChartsClass2 :: R.ReactClass Echarts
foreign import eChartsClass :: R.ReactClass Echarts
echarts
'
:: forall eff. Echarts -> R.ReactElement
echarts
' chart = R.createElementDynamic eChartsClass2
chart []
echarts :: forall eff. Echarts -> R.ReactElement
echarts
chart = R.createElementDynamic eChartsClass
chart []
legend' :: Legend
legend' =
{
"type": "plain"
id: ""
,"type": legendType Plain
, show: true
, zlevel:
Nothing
, z:
Nothing
, left:
Nothing
, top:
Nothing
, right:
Nothing
, bottom:
Nothing
, width:
Nothing
, height:
Nothing
, zlevel:
40.0
, z:
40.0
, left:
percentPosition 40.0
, top:
percentPosition 40.0
, right:
percentPosition 40.0
, bottom:
percentPosition 40.0
, width:
percentPosition 40.0
, height:
percentPosition 40.0
, orient: Nothing
, align: Nothing
, padding: Nothing
...
...
@@ -132,12 +131,12 @@ title =
,top: relativePosition (Relative Middle)
,right: numberPosition 60.0
,bottom: percentPosition 40.0
,backgroundColor:
renderC
hartColor black
,borderColor:
renderC
hartColor black
,backgroundColor:
c
hartColor black
,borderColor:
c
hartColor black
,borderWidth: 0.0
,borderRadius: 20.0
,shadowBlur: 0.0
,shadowColor:
renderC
hartColor black
,shadowColor:
c
hartColor black
,shadowOffsetX: 0.0
,shadowOffsetY: 0.0
}
...
...
@@ -145,9 +144,9 @@ title =
textStyle2 :: TextStyle
textStyle2 =
{
color:
renderC
hartColor yellow
,fontStyle:
renderC
hartFontStyle normal
,fontWeight:
renderC
hartFontWeight normal
color:
c
hartColor yellow
,fontStyle:
c
hartFontStyle normal
,fontWeight:
c
hartFontWeight normal
,fontFamily: "sans-serif"
,fontSize: 12
,align: relativePosition $ Relative RightPos
...
...
@@ -155,10 +154,10 @@ textStyle2 =
,lineHeight: percentPosition 0.0
,width: percentPosition 100.0
,height: percentPosition 100.0
,textBorderColor:
renderC
hartColor blue
,textBorderColor:
c
hartColor blue
,textBorderWidth: 5.0
,textShadowColor:
renderC
hartColor black
,textShadowBlur:
renderC
hartColor black
,textShadowColor:
c
hartColor black
,textShadowBlur:
c
hartColor black
,textShadowOffsetX: 0.0
,textShadowOffsetY: 0.0
}
...
...
@@ -167,9 +166,9 @@ textStyle2 =
textStyle :: TextStyle
textStyle =
{
color:
renderC
hartColor white
,fontStyle:
renderC
hartFontStyle normal
,fontWeight:
renderC
hartFontWeight normal
color:
c
hartColor white
,fontStyle:
c
hartFontStyle normal
,fontWeight:
c
hartFontWeight normal
,fontFamily: "sans-serif"
,fontSize: 12
,align: relativePosition $ Relative LeftPos
...
...
@@ -177,10 +176,10 @@ textStyle =
,lineHeight: percentPosition 0.0
,width: percentPosition 100.0
,height: percentPosition 100.0
,textBorderColor:
renderC
hartColor blue
,textBorderColor:
c
hartColor blue
,textBorderWidth: 5.0
,textShadowColor:
renderC
hartColor black
,textShadowBlur:
renderC
hartColor black
,textShadowColor:
c
hartColor black
,textShadowBlur:
c
hartColor black
,textShadowOffsetX: 0.0
,textShadowOffsetY: 0.0
}
...
...
@@ -204,7 +203,7 @@ charts =
}
histogram2 :: R.ReactElement
histogram2 = echarts
'
charts
histogram2 = echarts charts
{-
histogram :: R.ReactElement
...
...
src/Charts/Font.purs
View file @
1e9c64d6
module Charts.Font where
module Charts.Font
(
ChartFontStyle(),
chartFontStyle,
ChartFontWeight(),
chartFontWeight
) where
import CSS (FontStyle(..), FontWeight(..), Prefixed(..), Value(..))
newtype ChartFontStyle = ChartFontStyle String
renderC
hartFontStyle :: FontStyle -> ChartFontStyle
renderC
hartFontStyle (FontStyle (Value (Plain "italic"))) = ChartFontStyle "italic"
renderC
hartFontStyle (FontStyle (Value (Plain "oblique"))) = ChartFontStyle "oblique"
renderC
hartFontStyle _ = ChartFontStyle "normal"
c
hartFontStyle :: FontStyle -> ChartFontStyle
c
hartFontStyle (FontStyle (Value (Plain "italic"))) = ChartFontStyle "italic"
c
hartFontStyle (FontStyle (Value (Plain "oblique"))) = ChartFontStyle "oblique"
c
hartFontStyle _ = ChartFontStyle "normal"
newtype ChartFontWeight = ChartFontWeight String
renderC
hartFontWeight :: FontWeight -> ChartFontWeight
renderC
hartFontWeight (FontWeight (Value (Plain "bold"))) = ChartFontWeight "bold"
renderC
hartFontWeight (FontWeight (Value (Plain "bolder"))) = ChartFontWeight "bolder"
renderC
hartFontWeight (FontWeight (Value (Plain "lighter"))) = ChartFontWeight "lighter"
renderC
hartFontWeight _ = ChartFontWeight "normal"
c
hartFontWeight :: FontWeight -> ChartFontWeight
c
hartFontWeight (FontWeight (Value (Plain "bold"))) = ChartFontWeight "bold"
c
hartFontWeight (FontWeight (Value (Plain "bolder"))) = ChartFontWeight "bolder"
c
hartFontWeight (FontWeight (Value (Plain "lighter"))) = ChartFontWeight "lighter"
c
hartFontWeight _ = ChartFontWeight "normal"
src/Charts/Legend.purs
0 → 100644
View file @
1e9c64d6
module Charts.Legend
(
LegendType(),
PlainOrScroll(..),
legendType,
Orient(),
Orientation(..),
orient
) where
import Data.Generic (class Generic, gShow)
import Data.String (toLower)
import Prelude ((<<<))
newtype LegendType = LegendType String
data PlainOrScroll = Plain | Scroll
derive instance genericPlainOrScroll :: Generic PlainOrScroll
legendType :: PlainOrScroll -> LegendType
legendType = LegendType <<< toLower <<< gShow
newtype Orient = Orient String
data Orientation = Horizontal | Vertical
derive instance genericOrientation :: Generic Orientation
orient :: Orientation -> Orient
orient = Orient <<< toLower <<< gShow
src/Charts/Position.purs
View file @
1e9c64d6
module Charts.Position where
module Charts.Position
(
Position(),
numberPosition,
percentPosition,
relativePosition,
Align(..),
TopRelativePosition(..),
LeftRelativePosition(..)
) where
import Prelude (class Show, show, ($), (<>))
import Unsafe.Coerce (unsafeCoerce)
...
...
src/Charts/Type.purs
View file @
1e9c64d6
module Charts.Type where
import Charts.Position (LeftRelativePosition, Position, TopRelativePosition)
import Charts.Font
import Charts.Color (ChartColor)
import CSS (Color)
import Charts.Color (ChartColor)
import Charts.Legend (LegendType)
import Charts.Position (LeftRelativePosition, Position, TopRelativePosition)
import Data.Either (Either)
import Data.Maybe (Maybe)
import Prelude (Unit, (<<<))
...
...
@@ -89,27 +91,29 @@ type Grid =
}
type Legend =
{"type" :: String
, show :: Boolean
, zlevel :: Maybe Number
, z :: Maybe Number
, left :: Maybe Number
, top :: Maybe Number
, right :: Maybe Number
, bottom :: Maybe Number
, width :: Maybe Number
, height :: Maybe Number
{
id :: String
, "type" :: LegendType
, show :: Boolean
, zlevel :: Number
, z :: Number
, left :: Position LeftRelativePosition -- default 'auto
, top :: Position TopRelativePosition
, right :: Position Unit
, bottom :: Position Unit
, width :: Position Unit
, height :: Position Unit
, orient :: Maybe String
, align
:: Maybe String
, padding
:: Maybe Number
, itemGap
:: Maybe Number
, itemWidth
:: Maybe Number
, itemHeight
:: Maybe Number
, formatter
:: Maybe String
, selectedMode
:: Maybe Boolean
, align :: Maybe String
, padding :: Maybe Number
, itemGap :: Maybe Number
, itemWidth :: Maybe Number
, itemHeight :: Maybe Number
, formatter :: Maybe String
, selectedMode :: Maybe Boolean
, inactiveColor :: Maybe Color
, selected
:: Maybe String -- object
, "data"
:: Maybe (Array Data)
, selected :: Maybe String -- object
, "data" :: Maybe (Array Data)
}
type Data =
...
...
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