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
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 Prelude ((<<<))
import CSS (Color, toHexString)
import CSS (Color, toHexString)
newtype ChartColor = ChartColor String
newtype ChartColor = ChartColor String
renderC
hartColor :: Color -> ChartColor
c
hartColor :: Color -> ChartColor
renderC
hartColor = ChartColor <<< toHexString
c
hartColor = ChartColor <<< toHexString
src/Charts/ECharts.js
View file @
1e9c64d6
...
@@ -3,4 +3,3 @@
...
@@ -3,4 +3,3 @@
var
ReactEcharts
=
require
(
"echarts-for-react"
);
var
ReactEcharts
=
require
(
"echarts-for-react"
);
exports
.
eChartsClass
=
ReactEcharts
.
default
;
exports
.
eChartsClass
=
ReactEcharts
.
default
;
exports
.
eChartsClass2
=
ReactEcharts
.
default
;
src/Charts/ECharts.purs
View file @
1e9c64d6
module Charts.ECharts where
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.Either (Either(..))
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Prelude (($))
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 as R
import React.DOM (p)
import React.DOM (p)
foreign import eChartsClass :: forall props. R.ReactClass props
foreign import eChartsClass :: R.ReactClass Echarts
foreign import eChartsClass2 :: R.ReactClass Echarts
echarts
'
:: forall eff. Echarts -> R.ReactElement
echarts :: forall eff. Echarts -> R.ReactElement
echarts
' chart = R.createElementDynamic eChartsClass2
chart []
echarts
chart = R.createElementDynamic eChartsClass
chart []
legend' :: Legend
legend' :: Legend
legend' =
legend' =
{
{
"type": "plain"
id: ""
,"type": legendType Plain
, show: true
, show: true
, zlevel:
Nothing
, zlevel:
40.0
, z:
Nothing
, z:
40.0
, left:
Nothing
, left:
percentPosition 40.0
, top:
Nothing
, top:
percentPosition 40.0
, right:
Nothing
, right:
percentPosition 40.0
, bottom:
Nothing
, bottom:
percentPosition 40.0
, width:
Nothing
, width:
percentPosition 40.0
, height:
Nothing
, height:
percentPosition 40.0
, orient: Nothing
, orient: Nothing
, align: Nothing
, align: Nothing
, padding: Nothing
, padding: Nothing
...
@@ -132,12 +131,12 @@ title =
...
@@ -132,12 +131,12 @@ title =
,top: relativePosition (Relative Middle)
,top: relativePosition (Relative Middle)
,right: numberPosition 60.0
,right: numberPosition 60.0
,bottom: percentPosition 40.0
,bottom: percentPosition 40.0
,backgroundColor:
renderC
hartColor black
,backgroundColor:
c
hartColor black
,borderColor:
renderC
hartColor black
,borderColor:
c
hartColor black
,borderWidth: 0.0
,borderWidth: 0.0
,borderRadius: 20.0
,borderRadius: 20.0
,shadowBlur: 0.0
,shadowBlur: 0.0
,shadowColor:
renderC
hartColor black
,shadowColor:
c
hartColor black
,shadowOffsetX: 0.0
,shadowOffsetX: 0.0
,shadowOffsetY: 0.0
,shadowOffsetY: 0.0
}
}
...
@@ -145,9 +144,9 @@ title =
...
@@ -145,9 +144,9 @@ title =
textStyle2 :: TextStyle
textStyle2 :: TextStyle
textStyle2 =
textStyle2 =
{
{
color:
renderC
hartColor yellow
color:
c
hartColor yellow
,fontStyle:
renderC
hartFontStyle normal
,fontStyle:
c
hartFontStyle normal
,fontWeight:
renderC
hartFontWeight normal
,fontWeight:
c
hartFontWeight normal
,fontFamily: "sans-serif"
,fontFamily: "sans-serif"
,fontSize: 12
,fontSize: 12
,align: relativePosition $ Relative RightPos
,align: relativePosition $ Relative RightPos
...
@@ -155,10 +154,10 @@ textStyle2 =
...
@@ -155,10 +154,10 @@ textStyle2 =
,lineHeight: percentPosition 0.0
,lineHeight: percentPosition 0.0
,width: percentPosition 100.0
,width: percentPosition 100.0
,height: percentPosition 100.0
,height: percentPosition 100.0
,textBorderColor:
renderC
hartColor blue
,textBorderColor:
c
hartColor blue
,textBorderWidth: 5.0
,textBorderWidth: 5.0
,textShadowColor:
renderC
hartColor black
,textShadowColor:
c
hartColor black
,textShadowBlur:
renderC
hartColor black
,textShadowBlur:
c
hartColor black
,textShadowOffsetX: 0.0
,textShadowOffsetX: 0.0
,textShadowOffsetY: 0.0
,textShadowOffsetY: 0.0
}
}
...
@@ -167,9 +166,9 @@ textStyle2 =
...
@@ -167,9 +166,9 @@ textStyle2 =
textStyle :: TextStyle
textStyle :: TextStyle
textStyle =
textStyle =
{
{
color:
renderC
hartColor white
color:
c
hartColor white
,fontStyle:
renderC
hartFontStyle normal
,fontStyle:
c
hartFontStyle normal
,fontWeight:
renderC
hartFontWeight normal
,fontWeight:
c
hartFontWeight normal
,fontFamily: "sans-serif"
,fontFamily: "sans-serif"
,fontSize: 12
,fontSize: 12
,align: relativePosition $ Relative LeftPos
,align: relativePosition $ Relative LeftPos
...
@@ -177,10 +176,10 @@ textStyle =
...
@@ -177,10 +176,10 @@ textStyle =
,lineHeight: percentPosition 0.0
,lineHeight: percentPosition 0.0
,width: percentPosition 100.0
,width: percentPosition 100.0
,height: percentPosition 100.0
,height: percentPosition 100.0
,textBorderColor:
renderC
hartColor blue
,textBorderColor:
c
hartColor blue
,textBorderWidth: 5.0
,textBorderWidth: 5.0
,textShadowColor:
renderC
hartColor black
,textShadowColor:
c
hartColor black
,textShadowBlur:
renderC
hartColor black
,textShadowBlur:
c
hartColor black
,textShadowOffsetX: 0.0
,textShadowOffsetX: 0.0
,textShadowOffsetY: 0.0
,textShadowOffsetY: 0.0
}
}
...
@@ -204,7 +203,7 @@ charts =
...
@@ -204,7 +203,7 @@ charts =
}
}
histogram2 :: R.ReactElement
histogram2 :: R.ReactElement
histogram2 = echarts
'
charts
histogram2 = echarts charts
{-
{-
histogram :: R.ReactElement
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(..))
import CSS (FontStyle(..), FontWeight(..), Prefixed(..), Value(..))
newtype ChartFontStyle = ChartFontStyle String
newtype ChartFontStyle = ChartFontStyle String
renderC
hartFontStyle :: FontStyle -> ChartFontStyle
c
hartFontStyle :: FontStyle -> ChartFontStyle
renderC
hartFontStyle (FontStyle (Value (Plain "italic"))) = ChartFontStyle "italic"
c
hartFontStyle (FontStyle (Value (Plain "italic"))) = ChartFontStyle "italic"
renderC
hartFontStyle (FontStyle (Value (Plain "oblique"))) = ChartFontStyle "oblique"
c
hartFontStyle (FontStyle (Value (Plain "oblique"))) = ChartFontStyle "oblique"
renderC
hartFontStyle _ = ChartFontStyle "normal"
c
hartFontStyle _ = ChartFontStyle "normal"
newtype ChartFontWeight = ChartFontWeight String
newtype ChartFontWeight = ChartFontWeight String
renderC
hartFontWeight :: FontWeight -> ChartFontWeight
c
hartFontWeight :: FontWeight -> ChartFontWeight
renderC
hartFontWeight (FontWeight (Value (Plain "bold"))) = ChartFontWeight "bold"
c
hartFontWeight (FontWeight (Value (Plain "bold"))) = ChartFontWeight "bold"
renderC
hartFontWeight (FontWeight (Value (Plain "bolder"))) = ChartFontWeight "bolder"
c
hartFontWeight (FontWeight (Value (Plain "bolder"))) = ChartFontWeight "bolder"
renderC
hartFontWeight (FontWeight (Value (Plain "lighter"))) = ChartFontWeight "lighter"
c
hartFontWeight (FontWeight (Value (Plain "lighter"))) = ChartFontWeight "lighter"
renderC
hartFontWeight _ = ChartFontWeight "normal"
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 Prelude (class Show, show, ($), (<>))
import Unsafe.Coerce (unsafeCoerce)
import Unsafe.Coerce (unsafeCoerce)
...
...
src/Charts/Type.purs
View file @
1e9c64d6
module Charts.Type where
module Charts.Type where
import Charts.Position (LeftRelativePosition, Position, TopRelativePosition)
import Charts.Font
import Charts.Font
import Charts.Color (ChartColor)
import CSS (Color)
import CSS (Color)
import Charts.Color (ChartColor)
import Charts.Legend (LegendType)
import Charts.Position (LeftRelativePosition, Position, TopRelativePosition)
import Data.Either (Either)
import Data.Either (Either)
import Data.Maybe (Maybe)
import Data.Maybe (Maybe)
import Prelude (Unit, (<<<))
import Prelude (Unit, (<<<))
...
@@ -89,27 +91,29 @@ type Grid =
...
@@ -89,27 +91,29 @@ type Grid =
}
}
type Legend =
type Legend =
{"type" :: String
{
, show :: Boolean
id :: String
, zlevel :: Maybe Number
, "type" :: LegendType
, z :: Maybe Number
, show :: Boolean
, left :: Maybe Number
, zlevel :: Number
, top :: Maybe Number
, z :: Number
, right :: Maybe Number
, left :: Position LeftRelativePosition -- default 'auto
, bottom :: Maybe Number
, top :: Position TopRelativePosition
, width :: Maybe Number
, right :: Position Unit
, height :: Maybe Number
, bottom :: Position Unit
, width :: Position Unit
, height :: Position Unit
, orient :: Maybe String
, orient :: Maybe String
, align
:: Maybe String
, align :: Maybe String
, padding
:: Maybe Number
, padding :: Maybe Number
, itemGap
:: Maybe Number
, itemGap :: Maybe Number
, itemWidth
:: Maybe Number
, itemWidth :: Maybe Number
, itemHeight
:: Maybe Number
, itemHeight :: Maybe Number
, formatter
:: Maybe String
, formatter :: Maybe String
, selectedMode
:: Maybe Boolean
, selectedMode :: Maybe Boolean
, inactiveColor :: Maybe Color
, inactiveColor :: Maybe Color
, selected
:: Maybe String -- object
, selected :: Maybe String -- object
, "data"
:: Maybe (Array Data)
, "data" :: Maybe (Array Data)
}
}
type 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