├── .gitignore ├── .travis.yml ├── README.md ├── bower.json ├── example └── src │ ├── Bar.purs │ ├── Funnel.purs │ ├── Gauge.purs │ ├── Graph.purs │ ├── Heatmap.purs │ ├── HeatmapCalendar.purs │ ├── K.purs │ ├── Line.purs │ ├── Main.purs │ ├── Pie.purs │ ├── Radar.purs │ ├── Scatter.purs │ ├── Utils.js │ └── Utils.purs ├── helpers.js ├── package.json ├── public ├── images │ └── logo.png └── index.html ├── script └── serve.js └── src ├── ECharts.purs └── ECharts ├── Chart.js ├── Chart.purs ├── Commands.purs ├── Event.js ├── Event.purs ├── Internal.js ├── Internal.purs ├── Monad.purs ├── Theme.js ├── Theme.purs ├── Types.purs └── Types └── Phantom.purs /.gitignore: -------------------------------------------------------------------------------- 1 | /output/ 2 | /node_modules/ 3 | /bower_components/ 4 | /tmp/ 5 | /dist/ 6 | public/*.js 7 | .psci_modules 8 | .psci 9 | .psc-ide-port 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | dist: trusty 3 | sudo: required 4 | node_js: 6 5 | install: 6 | - npm install -g bower 7 | - npm install && bower install 8 | script: 9 | - npm run build 10 | after_success: 11 | - >- 12 | test $TRAVIS_TAG && 13 | echo $GITHUB_TOKEN | pulp login && 14 | echo y | pulp publish --no-push 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # purescript-echarts 2 | 3 | Purescript bindings for Baidu's [Enterprise Charts (Echarts) charting library](https://github.com/ecomfe/echarts). 4 | 5 | [![Latest release](http://img.shields.io/github/release/slamdata/purescript-echarts.svg)](https://github.com/slamdata/purescript-echarts/releases) 6 | [![Build status](https://travis-ci.org/slamdata/purescript-echarts.svg?branch=master)](https://travis-ci.org/slamdata/purescript-echarts) 7 | 8 | ## API 9 | 10 | This approach drastically differs with __v2.0.0__. 11 | 12 | All basic echarts function are implemented as effectful functions. They are wrapped in `MonadEff` typeclass and could be used not only in `Eff` monad but in `Aff` and effectful transformers. 13 | 14 | `Option` object is constructed using `Writer` monad augmented with phantom rows. I.e. there is no any 15 | special type for `Option`, `Legend` or `Tooltip`, but they are `DSL PhantomRowsI` where `PhantomRowsI` is phantom row type. 16 | 17 | To write a field to objects one should use function from `ECharts.Commands` module. Row label of this function indicates if this function could be used for building particular objects. For example, if you build something like `Pie` series object you can use function `name` because it has type `forall i. String -> DSL (name :: I|i)` and `PieI` has this `name` label in its phantom part, but you can't use `symbol` because its type is `forall i. Symbol -> DSL (symbol :: I|i)` and `PieI` hasn't `symbol` label. 18 | 19 | ## Examples 20 | 21 | To run examples 22 | ```bash 23 | npm run build 24 | npm run serve 25 | ``` 26 | Then go to `localhost:5050` 27 | 28 | ## Notes 29 | 30 | * To use this lib in your project you need to add `echarts` npm dependency to your project. 31 | * This branch isn't fully implemented yet, although it has all features that we currently use in slamdata. 32 | * `Writer`'s log is `Array (Tuple String Foreign)`. There are three different functions that builds sub-dsls: `buildObj` takes pairs from log and write `Foreign`s as values to empty object; `buildArr` ignores first part of tuple and just write `Foreign`s to empty array, `buildSeries` takes first part of tuple and write it as `"type"` field to the second part (`Tuple "foo" $ toForeign {a: 12} -> toForeign {"type": "foo", a: 12}`) and then put it to empty array. 33 | * There are row names that differs with field names from __echarts__ docs. For example, __echarts__ uses `data` field and `purescript-echarts` uses `items`. Other thing is that some field names collide and to fix it there are new row names: `normalItemStyle`, `normalLabel`. 34 | * In this approach one could add new type for some field value (like `PercentOrPixel`) _OR_ add command (like `leftCenter`) _OR_ add new `DSL` for building foreign data (like `addItem`). 35 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "purescript-echarts", 3 | "license": "Apache-2.0", 4 | "repository": { 5 | "type": "git", 6 | "url": "git://github.com/slamdata/purescript-echarts.git" 7 | }, 8 | "authors": [ 9 | "John A. De Goes (http://degoes.net)", 10 | "Maxim Zimaliev " 11 | ], 12 | "ignore": [ 13 | "**/.*", 14 | "bower_components", 15 | "node_modules", 16 | "output", 17 | "tests", 18 | "tmp", 19 | "bower.json", 20 | "Gruntfile.js", 21 | "gulpfile.js", 22 | "package.json", 23 | "dist" 24 | ], 25 | "dependencies": { 26 | "purescript-eff": "^3.1.0", 27 | "purescript-control": "^3.3.1", 28 | "purescript-foreign": "^4.0.1", 29 | "purescript-dom": "^4.14.0", 30 | "purescript-transformers": "^3.5.0", 31 | "purescript-colors": "^4.3.0", 32 | "purescript-variant": "^4.0.0", 33 | "purescript-aff": "^4.0.2" 34 | }, 35 | "devDependencies": { 36 | "purescript-debug": "^3.0.0", 37 | "purescript-random": "^3.0.0", 38 | "purescript-nonempty": "^4.1.1", 39 | "purescript-signal": "^9.0.0", 40 | "purescript-now": "^3.0.0", 41 | "purescript-formatters": "^3.0.1" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /example/src/Bar.purs: -------------------------------------------------------------------------------- 1 | module Bar where 2 | 3 | import Prelude 4 | 5 | import Color as C 6 | 7 | import Control.Monad.Eff (Eff) 8 | import Control.Monad.Eff.Exception (EXCEPTION) 9 | import Control.Monad.Eff.Random (RANDOM, random) 10 | import DOM (DOM) 11 | import DOM.Node.Types (ElementId(..)) 12 | import Data.Array as Arr 13 | import Data.Maybe (Maybe(..)) 14 | import Data.Traversable as F 15 | import Debug.Trace as DT 16 | import ECharts.Chart as EC 17 | import ECharts.Commands as E 18 | import ECharts.Event as EE 19 | import ECharts.Monad (DSL', interpret) 20 | import ECharts.Types as ET 21 | import ECharts.Types.Phantom as ETP 22 | import Utils as U 23 | 24 | itemStyle ∷ DSL' ETP.ItemStyleI 25 | itemStyle = do 26 | E.normalItemStyle $ pure unit 27 | E.emphasisItemStyle do 28 | E.barBorderWidth 1.0 29 | E.shadowBlur 10.0 30 | E.shadowOffsetX 0.0 31 | E.shadowOffsetY 0.0 32 | E.shadowColor $ C.rgba 0 0 0 0.5 33 | 34 | type OptionInput = 35 | { label ∷ String 36 | , one ∷ Number 37 | , two ∷ Number 38 | , three ∷ Number 39 | , four ∷ Number 40 | } 41 | 42 | options ∷ Array OptionInput → DSL' ETP.OptionI 43 | options inp = do 44 | F.for_ (C.fromHexString "#eee") E.backgroundColor 45 | 46 | E.tooltip $ pure unit 47 | 48 | E.legend do 49 | E.items $ map ET.strItem [ "bar", "bar2", "bar3", "bar4" ] 50 | E.alignLeft 51 | E.left $ ET.Pixel 10 52 | 53 | E.brush do 54 | E.brushToolbox do 55 | E.rect 56 | E.polygon 57 | E.lineX 58 | E.lineY 59 | E.keep 60 | E.clear 61 | E.xAxisIndex 0 62 | 63 | E.toolbox do 64 | E.feature do 65 | E.magicType do 66 | E.magics do 67 | E.magicStack 68 | E.magicTiled 69 | E.dataZoomFeature E.shown 70 | E.dataView $ pure unit 71 | 72 | 73 | E.xAxis do 74 | E.name "X Axis" 75 | E.axisLine do 76 | E.onZero false 77 | E.splitLine E.hidden 78 | E.splitArea E.hidden 79 | E.silent false 80 | E.items $ map (ET.strItem <<< _.label) inp 81 | 82 | E.yAxis do 83 | E.inverse true 84 | E.splitArea E.hidden 85 | 86 | E.grid do 87 | E.left $ ET.Pixel 100 88 | 89 | E.visualMap do 90 | E.continuous do 91 | E.dimension 1 92 | E.textPair "High" "Low" 93 | E.inverse true 94 | E.itemHeight 200.0 95 | E.calculable true 96 | E.min (-2.0) 97 | E.max 6.0 98 | E.top $ ET.Pixel 60 99 | E.left $ ET.Pixel 10 100 | E.inRange do 101 | E.colorLightness 0.4 0.8 102 | E.outOfRange do 103 | F.for_ (C.fromHexString "#bbb") E.color 104 | E.controller do 105 | E.inRange do 106 | F.for_ (C.fromHexString "#2f4554") E.color 107 | E.series do 108 | E.bar do 109 | E.name "bar" 110 | E.stack "one" 111 | E.itemStyle itemStyle 112 | E.items $ map (ET.numItem <<< _.one) inp 113 | 114 | E.bar do 115 | E.name "bar2" 116 | E.stack "one" 117 | E.itemStyle itemStyle 118 | E.items $ map (ET.numItem <<< _.two) inp 119 | 120 | E.bar do 121 | E.name "bar3" 122 | E.stack "two" 123 | E.itemStyle itemStyle 124 | E.items $ map (ET.numItem <<< _.three) inp 125 | 126 | E.bar do 127 | E.name "bar4" 128 | E.stack "two" 129 | E.itemStyle itemStyle 130 | E.items $ map (ET.numItem <<< _.four) inp 131 | 132 | 133 | genInp ∷ ∀ e. Eff (random ∷ RANDOM|e) (Array OptionInput) 134 | genInp = F.for (Arr.range 0 10) \i → do 135 | let label = "Class " <> show i 136 | one ← random <#> ((_ * 2.0) >>> U.precise 2.0) 137 | two ← random <#> ((_ * -1.0) >>> U.precise 2.0) 138 | three ← random <#> ((_ * 5.0) >>> U.precise 2.0) 139 | four ← random <#> ((_ + 0.3) >>> U.precise 2.0) 140 | pure {label, one, two, three, four} 141 | 142 | chart ∷ ∀ e. Eff (random ∷ RANDOM, dom ∷ DOM, echarts ∷ ET.ECHARTS, exception ∷ EXCEPTION|e) Unit 143 | chart = do 144 | mbEl ← U.getElementById $ ElementId "bar" 145 | case mbEl of 146 | Nothing → DT.traceAnyA "There is no element with 'bar' id" 147 | Just el → do 148 | ch ← EC.init el 149 | inp ← genInp 150 | EC.setOption (interpret $ options inp) ch 151 | EC.getOption ch >>= DT.traceAnyA 152 | EE.listenAll ch DT.traceAnyA 153 | -------------------------------------------------------------------------------- /example/src/Funnel.purs: -------------------------------------------------------------------------------- 1 | module Funnel where 2 | 3 | import Prelude 4 | 5 | import Color as C 6 | 7 | import Control.Monad.Eff (Eff) 8 | import Control.Monad.Eff.Exception (EXCEPTION) 9 | 10 | import Data.Foldable as F 11 | import Data.Maybe (Maybe(..)) 12 | 13 | import Debug.Trace as DT 14 | 15 | import DOM (DOM) 16 | import DOM.Node.Types (ElementId(..)) 17 | 18 | import ECharts.Chart as EC 19 | import ECharts.Types as ET 20 | import ECharts.Types.Phantom as ETP 21 | import ECharts.Commands as E 22 | import ECharts.Monad (DSL', interpret) 23 | 24 | import Utils as U 25 | 26 | options ∷ DSL' ETP.OptionI 27 | options = do 28 | E.title do 29 | E.text "Funnel example" 30 | E.subtext "This is subtext" 31 | 32 | E.tooltip do 33 | E.triggerAxis 34 | E.formatterString "{a}
{b}: {c}" 35 | 36 | E.toolbox do 37 | E.feature do 38 | E.dataView $ E.readOnly false 39 | E.restore $ pure unit 40 | E.saveAsImage $ pure unit 41 | 42 | E.legend 43 | $ E.items 44 | $ map ET.strItem [ "one", "two", "three", "four", "five" ] 45 | 46 | E.series do 47 | E.funnel do 48 | E.name "Outer" 49 | E.left $ ET.Percent 10.0 50 | E.widthPct 80.0 51 | E.label do 52 | E.normalLabel do 53 | E.formatterString "{b} ???" 54 | E.emphasisLabel do 55 | E.positionInside 56 | E.formatterString "{b} ????" 57 | E.labelLine do 58 | E.normalLabelLine E.hidden 59 | E.itemStyle do 60 | E.normalItemStyle $ E.opacity 0.7 61 | 62 | E.buildItems do 63 | E.addItem do 64 | E.name "one" 65 | E.value 20.0 66 | E.addItem do 67 | E.name "two" 68 | E.value 40.0 69 | E.addItem do 70 | E.name "three" 71 | E.value 60.0 72 | E.addItem do 73 | E.name "four" 74 | E.value 80.0 75 | E.addItem do 76 | E.name "five" 77 | E.value 100.0 78 | 79 | E.funnel do 80 | E.name "Inner" 81 | E.left $ ET.Percent 10.0 82 | E.widthPct 80.0 83 | E.maxSizePct 80.0 84 | 85 | E.label do 86 | E.normalLabel do 87 | E.positionInside 88 | E.formatterString "{c}%" 89 | F.for_ (C.fromHexString "#fff") E.color 90 | E.emphasisLabel do 91 | E.positionInside 92 | E.formatterString "??? {c}%" 93 | 94 | E.itemStyle do 95 | E.normalItemStyle do 96 | E.opacity 0.5 97 | F.for_ (C.fromHexString "#fff") E.borderColor 98 | E.borderWidth 2 99 | 100 | E.buildItems do 101 | E.addItem do 102 | E.name "one" 103 | E.value 5.0 104 | E.addItem do 105 | E.name "two" 106 | E.value 10.0 107 | E.addItem do 108 | E.name "three" 109 | E.value 30.0 110 | E.addItem do 111 | E.name "four" 112 | E.value 50.0 113 | E.addItem do 114 | E.name "five" 115 | E.value 80.0 116 | 117 | chart ∷ ∀ e. Eff (dom ∷ DOM, echarts ∷ ET.ECHARTS, exception ∷ EXCEPTION|e) Unit 118 | chart = do 119 | mbEl ← U.getElementById $ ElementId "funnel" 120 | case mbEl of 121 | Nothing → DT.traceAnyA "There is no element with 'funnel' id" 122 | Just el → do 123 | ch ← EC.init el 124 | EC.setOption (interpret options) ch 125 | -------------------------------------------------------------------------------- /example/src/Gauge.purs: -------------------------------------------------------------------------------- 1 | module Gauge where 2 | 3 | import Prelude 4 | 5 | import Control.Monad.Eff (Eff) 6 | import Control.Monad.Eff.Exception (EXCEPTION) 7 | import Control.Monad.Eff.Random (RANDOM, random) 8 | 9 | import Data.Maybe (Maybe(..)) 10 | 11 | import Debug.Trace as DT 12 | 13 | import DOM (DOM) 14 | import DOM.Node.Types (ElementId(..)) 15 | 16 | import ECharts.Chart as EC 17 | import ECharts.Types as ET 18 | import ECharts.Types.Phantom as ETP 19 | import ECharts.Commands as E 20 | import ECharts.Monad (DSL', interpret) 21 | 22 | import Signal (Signal, runSignal, (~>)) 23 | import Signal.Time (every) 24 | 25 | import Utils as U 26 | 27 | options ∷ {speed ∷ Number, r ∷ Number, gas ∷ Number, water ∷ Number} → DSL' ETP.OptionI 28 | options obj = do 29 | E.tooltip $ E.formatterString "{a}
{c} {b}" 30 | 31 | E.toolbox do 32 | E.shown 33 | E.feature do 34 | E.restore E.shown 35 | E.saveAsImage E.shown 36 | 37 | E.series do 38 | E.gauge do 39 | E.name "SPEED" 40 | E.z 3 41 | E.min 0.0 42 | E.max 220.0 43 | E.splitNumber 11 44 | E.axisLine do 45 | E.lineStyle $ E.width 10 46 | E.axisTick do 47 | E.length 15 48 | E.lineStyle E.autoColor 49 | E.splitLine do 50 | E.length 20 51 | E.lineStyle E.autoColor 52 | E.title $ E.textStyle do 53 | E.bolderFontWeight 54 | E.fontSize 20 55 | E.italicFontStyle 56 | 57 | E.detail $ E.textStyle do 58 | E.bolderFontWeight 59 | 60 | E.buildItems $ E.addItem do 61 | E.name "km/h" 62 | E.value obj.speed 63 | 64 | E.gauge do 65 | E.name "R/MIN" 66 | E.center $ ET.Point { x: ET.Percent 20.0, y: ET.Percent 55.0 } 67 | E.gaugeRadius $ ET.Percent 35.0 68 | E.min 0.0 69 | E.max 7.0 70 | E.endAngle 45.0 71 | E.splitNumber 7 72 | E.axisLine $ E.lineStyle $ E.width 8 73 | E.axisTick do 74 | E.length 12 75 | E.lineStyle E.autoColor 76 | E.splitLine do 77 | E.length 20 78 | E.lineStyle E.autoColor 79 | E.gaugePointer $ E.width 5 80 | E.title $ E.offsetCenter $ ET.Point { x: ET.Pixel 0, y: ET.Percent (-30.0) } 81 | E.detail $ E.textStyle E.bolderFontWeight 82 | E.buildItems $ E.addItem do 83 | E.value obj.r 84 | E.name "x1000 r/min" 85 | 86 | E.gauge do 87 | E.name "GAS" 88 | E.center $ ET.Point { x: ET.Percent 77.0, y: ET.Percent 50.0 } 89 | E.gaugeRadius $ ET.Percent 25.0 90 | E.min 0.0 91 | E.max 2.0 92 | E.startAngle 135.0 93 | E.endAngle 45.0 94 | E.splitNumber 2 95 | E.axisLine $ E.lineStyle $ E.width 8 96 | E.axisTick do 97 | E.splitNumber 5 98 | E.length 10 99 | E.lineStyle E.autoColor 100 | E.axisLabel $ E.formatterValue \inp → 101 | case inp of 102 | 0.0 → "E" 103 | 1.0 → "Gas" 104 | 2.0 → "F" 105 | _ → "Err" 106 | E.splitLine do 107 | E.length 15 108 | E.lineStyle E.autoColor 109 | E.gaugePointer $ E.width 2 110 | E.title E.hidden 111 | E.detail E.hidden 112 | E.buildItems $ E.addItem do 113 | E.name "gas" 114 | E.value obj.gas 115 | 116 | E.gauge do 117 | E.name "WATER" 118 | E.center $ ET.Point { x: ET.Percent 77.0, y: ET.Percent 50.0 } 119 | E.gaugeRadius $ ET.Percent 25.0 120 | E.min 0.0 121 | E.max 2.0 122 | E.startAngle 315.0 123 | E.endAngle 225.0 124 | E.splitNumber 2 125 | E.axisLine $ E.lineStyle $ E.width 8 126 | E.axisTick E.hidden 127 | E.axisLabel $ E.formatterValue \inp → 128 | case inp of 129 | 0.0 → "H" 130 | 1.0 → "Water" 131 | 2.0 → "C" 132 | _ → "Err" 133 | E.splitLine do 134 | E.length 15 135 | E.lineStyle E.autoColor 136 | E.gaugePointer $ E.width 8 137 | E.title E.hidden 138 | E.detail E.hidden 139 | E.buildItems $ E.addItem do 140 | E.name "water" 141 | E.value obj.water 142 | 143 | 144 | initialVal ∷ {speed ∷ Number, r ∷ Number, gas ∷ Number, water ∷ Number} 145 | initialVal = 146 | { speed: 40.0 147 | , r: 1.5 148 | , gas: 0.5 149 | , water: 0.5 150 | } 151 | 152 | 153 | 154 | dataStream 155 | ∷ ∀ e. Signal (Eff (random ∷ RANDOM|e) {speed ∷ Number, r ∷ Number, gas ∷ Number, water ∷ Number }) 156 | dataStream = 157 | every 2000.0 ~> \_ → do 158 | speed ← random <#> (mul 100.0 >>> U.precise 2.0) 159 | r ← random <#> (mul 7.0 >>> U.precise 2.0) 160 | gas ← random <#> (mul 2.0 >>> U.precise 2.0) 161 | water ← random <#> (mul 2.0 >>> U.precise 2.0) 162 | pure {speed, r, gas, water} 163 | 164 | 165 | 166 | chart ∷ ∀ e. Eff (random ∷ RANDOM, dom ∷ DOM, echarts ∷ ET.ECHARTS, exception ∷ EXCEPTION|e) Unit 167 | chart = do 168 | mbEl ← U.getElementById $ ElementId "gauge" 169 | case mbEl of 170 | Nothing → DT.traceAnyA "There is no element with 'gauge' id" 171 | Just el → do 172 | ch ← EC.init el 173 | EC.setOption (interpret $ options initialVal) ch 174 | runSignal $ dataStream ~> \effVal → do 175 | val ← effVal 176 | EC.setOption (interpret $ options val) ch 177 | -------------------------------------------------------------------------------- /example/src/Graph.purs: -------------------------------------------------------------------------------- 1 | module Graph where 2 | 3 | import Prelude 4 | 5 | import Control.Monad.Eff (Eff) 6 | import Control.Monad.Eff.Exception (EXCEPTION) 7 | 8 | import Data.Maybe (Maybe(..)) 9 | 10 | import Debug.Trace as DT 11 | 12 | import DOM (DOM) 13 | import DOM.Node.Types (ElementId(..)) 14 | 15 | import ECharts.Chart as EC 16 | import ECharts.Types as ET 17 | import ECharts.Types.Phantom as ETP 18 | import ECharts.Commands as E 19 | import ECharts.Monad (DSL', interpret) 20 | 21 | import Utils as U 22 | 23 | options ∷ DSL' ETP.OptionI 24 | options = do 25 | E.title $ E.text "Graph" 26 | E.tooltip $ pure unit 27 | E.animationDurationUpdate 1500 28 | E.animationEasingUpdateQuinticInOut 29 | E.series do 30 | E.graph do 31 | E.layoutNone 32 | E.symbolSize 50 33 | E.roam true 34 | E.label $ E.normalLabel E.shown 35 | 36 | E.edgeSymbols do 37 | E.circleEdgeSymbol 38 | E.arrowEdgeSymbol 39 | E.edgeSymbolSizes 4 10 40 | 41 | E.edgeLabel $ E.normalEdgeLabel $ E.textStyle $ E.fontSize 20 42 | 43 | E.lineStylePair$ E.normalLineStyle do 44 | E.opacity 0.9 45 | E.width 2 46 | E.curveness 0.0 47 | 48 | E.buildItems do 49 | E.addItem do 50 | E.name "one" 51 | E.x 300.0 52 | E.y 300.0 53 | E.addItem do 54 | E.name "two" 55 | E.x 600.0 56 | E.y 300.0 57 | E.addItem do 58 | E.name "three" 59 | E.x 450.0 60 | E.y 100.0 61 | E.addItem do 62 | E.name "four" 63 | E.x 450.0 64 | E.y 500.0 65 | E.buildLinks do 66 | E.addLink do 67 | E.sourceIx 0 68 | E.targetIx 1 69 | E.symbolSizes 5 20 70 | E.label $ E.normalLabel E.shown 71 | E.lineStylePair $ E.normalLineStyle do 72 | E.width 5 73 | E.curveness 0.2 74 | E.addLink do 75 | E.sourceName "two" 76 | E.targetName "three" 77 | E.label $ E.normalLabel E.shown 78 | E.lineStylePair$ E.normalLineStyle $ E.curveness 0.2 79 | E.addLink do 80 | E.sourceName "one" 81 | E.targetName "three" 82 | E.addLink do 83 | E.sourceName "two" 84 | E.targetName "three" 85 | E.addLink do 86 | E.sourceName "two" 87 | E.targetName "four" 88 | E.addLink do 89 | E.sourceName "one" 90 | E.targetName "four" 91 | 92 | chart ∷ ∀ e. Eff (dom ∷ DOM, echarts ∷ ET.ECHARTS, exception ∷ EXCEPTION|e) Unit 93 | chart = do 94 | mbEl ← U.getElementById $ ElementId "graph" 95 | case mbEl of 96 | Nothing → DT.traceAnyA "There is no element with 'graph' id" 97 | Just el → do 98 | ch ← EC.init el 99 | EC.setOption (interpret options) ch 100 | -------------------------------------------------------------------------------- /example/src/Heatmap.purs: -------------------------------------------------------------------------------- 1 | module Heatmap where 2 | 3 | import Prelude 4 | 5 | import Color as C 6 | 7 | import Control.Monad.Eff (Eff) 8 | import Control.Monad.Eff.Exception (EXCEPTION) 9 | 10 | import Data.Array as A 11 | import Data.Foldable (traverse_) 12 | import Data.Int (toNumber) 13 | import Data.Maybe (Maybe(..)) 14 | 15 | import Debug.Trace as DT 16 | 17 | import DOM (DOM) 18 | import DOM.Node.Types (ElementId(..)) 19 | 20 | import ECharts.Chart as EC 21 | import ECharts.Types as ET 22 | import ECharts.Types.Phantom as ETP 23 | import ECharts.Commands as E 24 | import ECharts.Monad (DSL', interpret) 25 | 26 | import Utils as U 27 | 28 | hours ∷ Array String 29 | hours = 30 | [ "12am", "1am", "2am", "3am", "4am", "5am" 31 | , "6am", "7am", "8am", "9am", "10am", "11am" 32 | , "12pm", "1pm", "2pm", "3pm", "4pm", "5pm" 33 | , "6pm", "7pm", "8pm", "9pm", "10pm", "11pm" 34 | ] 35 | 36 | days ∷ Array String 37 | days = 38 | [ "Saturday" 39 | , "Friday" 40 | , "Thursday" 41 | , "Wednesday" 42 | , "Tuesday" 43 | , "Monday" 44 | , "Sunday" 45 | ] 46 | 47 | arrValues ∷ Array (Array Int) 48 | arrValues = 49 | [ [0, 0, 5], [0, 1, 1], [0, 2, 0], [0, 3, 0], [0, 4, 0], [0, 5, 0], [0, 6, 0] 50 | , [0, 7, 0], [0, 8, 0], [0, 9, 0], [0, 10, 0], [0, 11, 2], [0, 12, 4], [0, 13, 1] 51 | , [0, 14, 1], [0, 15, 3], [0, 16, 4], [0, 17, 6], [0, 18, 4], [0, 19, 4], [0, 20, 3] 52 | , [0, 21, 3], [0, 22, 2], [0, 23, 5], [1, 0, 7], [1, 1, 0], [1, 2, 0], [1, 3, 0] 53 | , [1, 4, 0], [1, 5, 0], [1, 6, 0], [1, 7, 0], [1, 8, 0], [1, 9, 0], [1, 10, 5] 54 | , [1, 11, 2], [1, 12, 2], [1, 13, 6], [1, 14, 9], [1, 15, 11], [1, 16, 6], [1, 17, 7] 55 | , [1, 18, 8], [1, 19, 12], [1, 20, 5], [1, 21, 5], [1, 22, 7], [1, 23, 2], [2, 0, 1] 56 | , [2, 1, 1], [2, 2, 0], [2, 3, 0], [2, 4, 0], [2, 5, 0], [2, 6, 0], [2, 7, 0] 57 | , [2, 8, 0], [2, 9, 0], [2, 10, 3], [2, 11, 2], [2, 12, 1], [2, 13, 9], [2, 14, 8] 58 | , [2, 15, 10], [2, 16, 6], [2, 17, 5], [2, 18, 5], [2, 19, 5], [2, 20, 7], [2, 21, 4] 59 | , [2, 22, 2], [2, 23, 4], [3, 0, 7], [3, 1, 3], [3, 2, 0], [3, 3, 0], [3, 4, 0] 60 | , [3, 5, 0], [3, 6, 0], [3, 7, 0], [3, 8, 1], [3, 9, 0], [3, 10, 5], [3, 11, 4] 61 | , [3, 12, 7], [3, 13, 14], [3, 14, 13], [3, 15, 12], [3, 16, 9], [3, 17, 5], [3, 18, 5] 62 | , [3, 19, 10], [3, 20, 6], [3, 21, 4], [3, 22, 4], [3, 23, 1], [4, 0, 1], [4, 1, 3] 63 | , [4, 2, 0], [4, 3, 0], [4, 4, 0], [4, 5, 1], [4, 6, 0], [4, 7, 0], [4, 8, 0] 64 | , [4, 9, 2], [4, 10, 4], [4, 11, 4], [4, 12, 2], [4, 13, 4], [4, 14, 4], [4, 15, 14] 65 | , [4, 16, 12], [4, 17, 1], [4, 18, 8], [4, 19, 5], [4, 20, 3], [4, 21, 7], [4, 22, 3] 66 | , [4, 23, 0], [5, 0, 2], [5, 1, 1], [5, 2, 0], [5, 3, 3], [5, 4, 0], [5, 5, 0] 67 | , [5, 6, 0], [5, 7, 0], [5, 8, 2], [5, 9, 0], [5, 10, 4], [5, 11, 1], [5, 12, 5] 68 | , [5, 13, 10], [5, 14, 5], [5, 15, 7], [5, 16, 11], [5, 17, 6], [5, 18, 0], [5, 19, 5] 69 | , [5, 20, 3], [5, 21, 4], [5, 22, 2], [5, 23, 0], [6, 0, 1], [6, 1, 0], [6, 2, 0] 70 | , [6, 3, 0], [6, 4, 0], [6, 5, 0], [6, 6, 0], [6, 7, 0], [6, 8, 0], [6, 9, 0] 71 | , [6, 10, 1], [6, 11, 0], [6, 12, 2], [6, 13, 1], [6, 14, 3], [6, 15, 4], [6, 16, 0] 72 | , [6, 17, 0], [6, 18, 0], [6, 19, 0], [6, 20, 1], [6, 21, 2], [6, 22, 2], [6, 23, 6] 73 | ] 74 | 75 | values ∷ ∀ i. Array (DSL' (value ∷ ETP.I|i)) 76 | values = A.catMaybes $ arrValues <#> case _ of 77 | [x, y, z] → pure $ E.buildValues do 78 | E.addValue $ toNumber y 79 | E.addValue $ toNumber x 80 | if z == zero 81 | then E.missingValue 82 | else E.addValue $ toNumber z 83 | _ → Nothing 84 | 85 | options ∷ DSL' ETP.OptionI 86 | options = do 87 | E.tooltip $ pure unit 88 | E.animationEnabled false 89 | E.grid do 90 | E.heightPixelOrPercent $ ET.Percent 50.0 91 | E.top $ ET.Percent 10.0 92 | E.xAxis do 93 | E.axisType ET.Category 94 | E.items $ map ET.strItem hours 95 | E.splitArea E.shown 96 | E.yAxis do 97 | E.axisType ET.Category 98 | E.items $ map ET.strItem days 99 | E.splitArea E.shown 100 | E.visualMap $ E.continuous do 101 | E.min 0.0 102 | E.max 10.0 103 | E.calculable true 104 | E.orient ET.Horizontal 105 | E.leftCenter 106 | E.bottom $ ET.Percent 15.0 107 | E.series $ E.heatMap do 108 | E.name "Heatmap Punch Card" 109 | E.label $ E.normal E.shown 110 | E.itemStyle $ E.emphasis do 111 | E.shadowBlur 10.0 112 | E.shadowColor $ C.rgba 0 0 0 0.5 113 | E.buildItems 114 | $ traverse_ E.addItem values 115 | 116 | 117 | chart ∷ ∀ e. Eff (dom ∷ DOM, echarts ∷ ET.ECHARTS, exception ∷ EXCEPTION|e) Unit 118 | chart = do 119 | mbEl ← U.getElementById $ ElementId "heatmap" 120 | case mbEl of 121 | Nothing → DT.traceAnyA "There is no element with 'heatmap' id" 122 | Just el → do 123 | ch ← EC.init el 124 | EC.setOption (interpret options) ch 125 | -------------------------------------------------------------------------------- /example/src/HeatmapCalendar.purs: -------------------------------------------------------------------------------- 1 | module HeatmapCalendar where 2 | 3 | import Prelude 4 | 5 | import Control.Monad.Eff (Eff) 6 | import Control.Monad.Eff.Exception (EXCEPTION) 7 | 8 | import Data.Array as A 9 | import Data.Date as D 10 | import Data.Enum (toEnum) 11 | import Data.Foldable (traverse_) 12 | import Data.Maybe (Maybe(..), fromJust) 13 | 14 | import Debug.Trace as DT 15 | 16 | import DOM (DOM) 17 | import DOM.Node.Types (ElementId(..)) 18 | 19 | import ECharts.Chart as EC 20 | import ECharts.Types as ET 21 | import ECharts.Types.Phantom as ETP 22 | import ECharts.Commands as E 23 | import ECharts.Monad (DSL', interpret) 24 | 25 | import Partial.Unsafe (unsafePartial) 26 | import Utils as U 27 | 28 | arrValues ∷ Array (Array String) 29 | arrValues = 30 | [ [ "2017-01-01", "203" ], [ "2017-01-02", "980" ], [ "2017-01-03", "14" ] 31 | , [ "2017-01-04", "284" ], [ "2017-01-05", "584" ], [ "2017-01-06", "723" ] 32 | , [ "2017-01-07", "209" ], [ "2017-01-08", "219" ], [ "2017-01-09", "916" ] 33 | , [ "2017-01-10", "747" ], [ "2017-01-11", "702" ], [ "2017-01-12", "749" ] 34 | , [ "2017-01-13", "815" ], [ "2017-01-14", "777" ], [ "2017-01-15", "831" ] 35 | , [ "2017-01-16", "109" ], [ "2017-01-17", "385" ], [ "2017-01-18", "428" ] 36 | , [ "2017-01-19", "499" ], [ "2017-01-20", "58" ], [ "2017-01-21", "818" ] 37 | , [ "2017-01-22", "455" ], [ "2017-01-23", "40" ], [ "2017-01-24", "612" ] 38 | , [ "2017-01-25", "219" ], [ "2017-01-26", "854" ], [ "2017-01-27", "398" ] 39 | , [ "2017-01-28", "193" ], [ "2017-01-29", "31" ], [ "2017-01-30", "575" ] 40 | , [ "2017-01-31", "541" ], [ "2017-02-01", "548" ], [ "2017-02-02", "915" ] 41 | , [ "2017-02-03", "606" ], [ "2017-02-04", "380" ], [ "2017-02-05", "853" ] 42 | , [ "2017-02-06", "530" ], [ "2017-02-07", "295" ], [ "2017-02-08", "424" ] 43 | , [ "2017-02-09", "593" ], [ "2017-02-10", "352" ], [ "2017-02-11", "939" ] 44 | , [ "2017-02-12", "244" ], [ "2017-02-13", "726" ], [ "2017-02-14", "624" ] 45 | , [ "2017-02-15", "38" ], [ "2017-02-16", "87" ], [ "2017-02-17", "905" ] 46 | , [ "2017-02-18", "925" ], [ "2017-02-19", "477" ], [ "2017-02-20", "514" ] 47 | , [ "2017-02-21", "762" ], [ "2017-02-22", "365" ], [ "2017-02-23", "425" ] 48 | , [ "2017-02-24", "528" ], [ "2017-02-25", "859" ], [ "2017-02-26", "802" ] 49 | , [ "2017-02-27", "992" ], [ "2017-02-28", "342" ] ] 50 | 51 | values ∷ ∀ i. Array (DSL' (value ∷ ETP.I|i)) 52 | values = A.catMaybes $ arrValues <#> case _ of 53 | [x, y] → pure $ E.buildValues do 54 | E.addStringValue x 55 | E.addStringValue y 56 | _ → Nothing 57 | 58 | options ∷ DSL' ETP.OptionI 59 | options = do 60 | E.tooltip do 61 | E.positionTop 62 | E.visualMap $ E.continuous do 63 | E.min 0.0 64 | E.max 1000.0 65 | E.calculable true 66 | E.orient ET.Horizontal 67 | E.leftCenter 68 | E.bottom $ ET.Percent 15.0 69 | E.calendar do 70 | E.calendarSpec do 71 | E.buildRange do 72 | E.addDateValue $ D.canonicalDate year D.January day 73 | E.addDateValue $ D.canonicalDate year D.January day' 74 | E.buildCellSize do 75 | E.autoValue 76 | E.addValue 12.0 77 | E.calendarSpec do 78 | E.buildRange do 79 | E.addStringValue "2017-02" 80 | E.buildCellSize do 81 | E.autoValue 82 | E.addValue 12.0 83 | E.top (ET.Pixel 300) 84 | E.series do 85 | E.heatMap do 86 | E.calendarCoordinateSystem 87 | E.calendarIndex 0 88 | E.buildItems 89 | $ traverse_ E.addItem values 90 | E.heatMap do 91 | E.calendarCoordinateSystem 92 | E.calendarIndex 1 93 | E.buildItems 94 | $ traverse_ E.addItem values 95 | where 96 | year = unsafePartial $ fromJust <<< toEnum $ 2017 97 | day = unsafePartial $ fromJust <<< toEnum $ 1 98 | day' = unsafePartial $ fromJust <<< toEnum $ 31 99 | 100 | 101 | chart ∷ ∀ e. Eff (dom ∷ DOM, echarts ∷ ET.ECHARTS, exception ∷ EXCEPTION|e) Unit 102 | chart = do 103 | mbEl ← U.getElementById $ ElementId "heatmap-calendar" 104 | case mbEl of 105 | Nothing → DT.traceAnyA "There is no element with 'heatmap-calendar' id" 106 | Just el → do 107 | ch ← EC.init el 108 | EC.setOption (interpret options) ch 109 | -------------------------------------------------------------------------------- /example/src/K.purs: -------------------------------------------------------------------------------- 1 | module K where 2 | 3 | import Prelude 4 | 5 | import Control.Monad.Eff (Eff) 6 | import Control.Monad.Eff.Exception (EXCEPTION) 7 | 8 | import Data.Foldable as F 9 | import Data.Maybe (Maybe(..)) 10 | 11 | import Debug.Trace as DT 12 | 13 | import DOM (DOM) 14 | import DOM.Node.Types (ElementId(..)) 15 | 16 | import ECharts.Chart as EC 17 | import ECharts.Types as ET 18 | import ECharts.Types.Phantom as ETP 19 | import ECharts.Commands as E 20 | import ECharts.Monad (DSL', interpret) 21 | 22 | import Utils as U 23 | 24 | options ∷ DSL' ETP.OptionI 25 | options = do 26 | E.xAxis do 27 | E.axisType ET.Category 28 | E.items $ map ET.strItem ["2013/1/24", "2013/1/25", "2013/1/28", "2013/1/29", "2013/1/30" ] 29 | E.yAxis do 30 | E.axisType ET.Value 31 | E.min 2200.0 32 | E.scale true 33 | E.series $ E.candlestick do 34 | E.markLine do 35 | E.lineStyle $ E.normal do 36 | E.solidLine 37 | E.buildMarkItems do 38 | E.addItem do 39 | E.symbol ET.Diamond 40 | E.buildCoord do 41 | E.coordXValue "2013/1/24" 42 | E.coordY "2200.00" 43 | E.addItem do 44 | E.symbol ET.Diamond 45 | E.buildCoord do 46 | E.coordXValue "2013/1/29" 47 | E.coordY "2300.00" 48 | 49 | E.buildItems 50 | $ F.traverse_ (E.addItem <<< E.values) 51 | [ [ 2320.26, 2302.6, 2287.3, 2362.94 ] 52 | , [ 2300.00, 2291.3, 2288.26, 2308.38 ] 53 | , [ 2295.35, 2346.5, 2295.35, 2346.92 ] 54 | , [ 2347.22, 2358.98, 2337.35, 2363.8 ] 55 | , [ 2360.75, 2382.48, 2347.89, 2383.76 ] 56 | ] 57 | 58 | chart ∷ ∀ e. Eff (dom ∷ DOM, echarts ∷ ET.ECHARTS, exception ∷ EXCEPTION|e) Unit 59 | chart = do 60 | mbEl ← U.getElementById $ ElementId "k" 61 | case mbEl of 62 | Nothing → DT.traceAnyA "There is no element with 'k' id" 63 | Just el → do 64 | ch ← EC.init el 65 | EC.setOption (interpret options) ch 66 | -------------------------------------------------------------------------------- /example/src/Line.purs: -------------------------------------------------------------------------------- 1 | module Line where 2 | 3 | import Prelude 4 | 5 | import Control.Monad.Eff (Eff) 6 | import Control.Monad.Eff.Exception (EXCEPTION) 7 | import Control.Monad.Eff.Random (RANDOM, random) 8 | import Control.Monad.Eff.Now (NOW, now) 9 | 10 | import Data.Array (head) 11 | import Data.Either (either) 12 | import Data.Maybe (Maybe(..), maybe, fromMaybe) 13 | import Data.Formatter.DateTime as FDT 14 | import Data.DateTime as D 15 | import Data.DateTime.Instant (toDateTime) 16 | import Data.Time.Duration (Milliseconds(..)) 17 | 18 | import DOM (DOM) 19 | import DOM.Node.Types (ElementId(..)) 20 | 21 | import Debug.Trace as DT 22 | 23 | import ECharts.Chart as EC 24 | import ECharts.Types as ET 25 | import ECharts.Commands as E 26 | import ECharts.Monad (DSL', interpret) 27 | import ECharts.Types.Phantom (I) 28 | import ECharts.Types.Phantom as ETP 29 | 30 | import Signal (Signal, runSignal, (~>), foldp) 31 | import Signal.Time (every) 32 | 33 | import Utils as U 34 | 35 | startOptions ∷ DSL' ETP.OptionI 36 | startOptions = do 37 | E.useUTC true 38 | E.title do 39 | E.text "Dynamic line" 40 | E.tooltip do 41 | E.trigger ET.AxisTrigger 42 | E.formatterAxis \params → head params # maybe ("Incorrect date") _.name 43 | E.animationEnabled false 44 | E.xAxis do 45 | E.splitLine E.hidden 46 | E.axisType ET.Time 47 | 48 | E.yAxis do 49 | E.axisType ET.Value 50 | E.splitLine E.hidden 51 | E.boundaryGap $ ET.Point { x: ET.Pixel 0, y: ET.Percent 100.0 } 52 | 53 | E.series $ E.line do 54 | E.name "Dynamic line" 55 | E.hoverAnimationEnabled false 56 | E.showSymbol false 57 | pure unit 58 | 59 | type Accum = 60 | { dt ∷ D.DateTime 61 | , value ∷ Number 62 | , values ∷ Array (DSL' ETP.ItemI) 63 | } 64 | 65 | dataStream 66 | ∷ ∀ e i. Accum → Signal (Eff (random ∷ RANDOM|e) (DSL' (items ∷ I|i))) 67 | dataStream start = 68 | accumStream ~> map (void <<< E.itemsDSL <<< _.values) 69 | where 70 | accumStream = 71 | foldp foldFn (pure start) (every 2000.0) 72 | 73 | foldFn _ eAcc = do 74 | acc ← eAcc 75 | ran ← random 76 | let 77 | oneDay = Milliseconds (24.0 * 3600.0 * 1000.0) 78 | newTime = fromMaybe acc.dt $ D.adjust oneDay acc.dt 79 | newTimeLabel = either (const $ "Incorrect date") id $ FDT.formatDateTime "YYYY-MM-DD" newTime 80 | newValue = acc.value + (ran * 21.0 - 10.0) 81 | 82 | newItem ∷ DSL' ETP.ItemI 83 | newItem = do 84 | E.name newTimeLabel 85 | E.valuePair newTimeLabel newValue 86 | 87 | pure { value: newValue, dt: newTime, values: [newItem] <> acc.values } 88 | 89 | optStream ∷ ∀ e. Accum → Signal (Eff (now ∷ NOW, random ∷ RANDOM|e) (DSL' ETP.OptionI)) 90 | optStream acc = 91 | dataStream acc ~> \effItemsSet → do 92 | itemsSet ← effItemsSet 93 | pure $ E.series $ E.line itemsSet 94 | 95 | chart ∷ ∀ e. Eff (now ∷ NOW, dom ∷ DOM, exception ∷ EXCEPTION, echarts ∷ ET.ECHARTS, random ∷ RANDOM|e) Unit 96 | chart = do 97 | mbEl ← U.getElementById $ ElementId "line" 98 | case mbEl of 99 | Nothing → DT.traceAnyA "There is no element with line id" 100 | Just el → do 101 | ch ← EC.init el 102 | EC.setOption (interpret startOptions) ch 103 | timeStart ← map toDateTime now 104 | valueStart ← random 105 | runSignal $ optStream {dt: timeStart, value: valueStart, values: []} ~> \effOpt → do 106 | opt ← effOpt 107 | EC.setOption (interpret opt) ch 108 | -------------------------------------------------------------------------------- /example/src/Main.purs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Prelude 4 | 5 | import Control.Monad.Eff (Eff) 6 | import Control.Monad.Eff.Exception (EXCEPTION) 7 | import Control.Monad.Eff.Random (RANDOM) 8 | import Control.Monad.Eff.Now (NOW) 9 | 10 | import DOM (DOM) 11 | 12 | import ECharts.Types as ET 13 | 14 | import Line as Line 15 | import Scatter as Scatter 16 | import Pie as Pie 17 | import Bar as Bar 18 | import Gauge as Gauge 19 | import Funnel as Funnel 20 | import Radar as Radar 21 | import Graph as Graph 22 | import K as K 23 | import Heatmap as Heatmap 24 | import HeatmapCalendar as HeatmapCalendar 25 | 26 | import Utils as U 27 | 28 | main 29 | ∷ ∀ e 30 | . Eff ( now ∷ NOW 31 | , dom ∷ DOM 32 | , echarts ∷ ET.ECHARTS 33 | , exception ∷ EXCEPTION 34 | , random ∷ RANDOM 35 | | e ) 36 | Unit 37 | main = U.onLoad do 38 | Line.chart 39 | Scatter.chart 40 | Pie.chart 41 | Bar.chart 42 | Gauge.chart 43 | Funnel.chart 44 | Radar.chart 45 | Graph.chart 46 | K.chart 47 | Heatmap.chart 48 | HeatmapCalendar.chart 49 | -------------------------------------------------------------------------------- /example/src/Pie.purs: -------------------------------------------------------------------------------- 1 | module Pie where 2 | 3 | import Prelude 4 | 5 | import Control.Monad.Eff (Eff) 6 | import Control.Monad.Eff.Exception (EXCEPTION) 7 | import Data.Maybe (Maybe(..)) 8 | import Data.Symbol (SProxy(..)) 9 | import Data.Variant as V 10 | import Debug.Trace as DT 11 | import DOM (DOM) 12 | import DOM.Node.Types (ElementId(..)) 13 | import ECharts.Chart as EC 14 | import ECharts.Event as EE 15 | import ECharts.Types as ET 16 | import ECharts.Types.Phantom as ETP 17 | import ECharts.Commands as E 18 | import ECharts.Monad (DSL', interpret) 19 | import Utils as U 20 | 21 | options ∷ DSL' ETP.OptionI 22 | options = do 23 | E.tooltip do 24 | E.trigger ET.ItemTrigger 25 | E.formatterString "{a}
{b}: {c} ({d}%)" 26 | E.legend do 27 | E.orient ET.Vertical 28 | E.leftPosition $ ET.LeftHP 29 | E.items 30 | $ map ET.strItem 31 | [ "one", "two", "three", "four", "five", "six", "seven", "eight" ] 32 | E.series do 33 | E.pie do 34 | E.name "Inner" 35 | E.selectedMode ET.Single 36 | E.radius $ ET.Radius { start: ET.Pixel 0, end: ET.Percent 30.0 } 37 | E.label $ E.normalLabel E.hidden 38 | E.buildItems do 39 | E.addItem do 40 | E.value 335.0 41 | E.name "one" 42 | E.selected true 43 | E.addItem do 44 | E.value 679.0 45 | E.name "two" 46 | E.addItem do 47 | E.value 1548.0 48 | E.name "three" 49 | E.pie do 50 | E.name "Outer" 51 | E.selectedMode ET.Multiple 52 | E.radius $ ET.Radius { start: ET.Percent 40.0, end: ET.Percent 55.0 } 53 | E.buildItems do 54 | E.addItem do 55 | E.value 335.0 56 | E.name "one" 57 | E.addItem do 58 | E.value 310.0 59 | E.name "two" 60 | E.addItem do 61 | E.value 234.0 62 | E.name "three" 63 | E.addItem do 64 | E.value 135.0 65 | E.name "four" 66 | E.addItem do 67 | E.value 1048.0 68 | E.name "five" 69 | E.addItem do 70 | E.value 251.0 71 | E.name "six" 72 | E.addItem do 73 | E.value 147.0 74 | E.name "seven" 75 | E.addItem do 76 | E.value 102.0 77 | E.name "eight" 78 | 79 | 80 | chart ∷ ∀ e. Eff (dom ∷ DOM, echarts ∷ ET.ECHARTS, exception ∷ EXCEPTION|e) Unit 81 | chart = do 82 | mbEl ← U.getElementById $ ElementId "pie" 83 | case mbEl of 84 | Nothing → DT.traceAnyA "There is no element with pie id" 85 | Just el → do 86 | ch ← EC.init el 87 | EC.setOption (interpret options) ch 88 | EE.listenAll ch DT.traceAnyA 89 | EE.dispatch 90 | (V.inj (SProxy ∷ SProxy "pieselected") 91 | $ { seriesIndex: 1 92 | , seriesName: "Outer" 93 | , name: "seven" 94 | , dataIndex: 4 95 | }) 96 | ch 97 | -------------------------------------------------------------------------------- /example/src/Radar.purs: -------------------------------------------------------------------------------- 1 | module Radar where 2 | 3 | import Prelude 4 | 5 | import Color as C 6 | 7 | import Control.Monad.Eff (Eff) 8 | import Control.Monad.Eff.Exception (EXCEPTION) 9 | 10 | import Data.Foldable as F 11 | import Data.Maybe (Maybe(..)) 12 | 13 | import Debug.Trace as DT 14 | 15 | import DOM (DOM) 16 | import DOM.Node.Types (ElementId(..)) 17 | 18 | import ECharts.Chart as EC 19 | import ECharts.Types as ET 20 | import ECharts.Types.Phantom as ETP 21 | import ECharts.Commands as E 22 | import ECharts.Monad (DSL', interpret) 23 | 24 | import Utils as U 25 | 26 | lineStyle ∷ DSL' ETP.LineStylePairI 27 | lineStyle = E.normalLineStyle do 28 | E.width 1 29 | E.opacity 0.5 30 | 31 | 32 | options ∷ DSL' ETP.OptionI 33 | options = do 34 | F.for_ (C.fromHexString "#161627") E.backgroundColor 35 | 36 | E.title do 37 | E.text "AQI - Radar" 38 | E.leftCenter 39 | 40 | E.textStyle do 41 | F.for_ (C.fromHexString "#eee") E.color 42 | 43 | E.legend do 44 | E.bottom $ ET.Pixel 5 45 | E.items $ map ET.strItem ["Beijing", "Shanghai", "Guanzhou"] 46 | E.itemGap 20 47 | E.textStyle do 48 | F.for_ (C.fromHexString "#fff") E.color 49 | E.fontSize 14 50 | E.selectedMode ET.Single 51 | 52 | 53 | E.radar do 54 | E.indicators do 55 | E.indicator do 56 | E.name "AQI" 57 | E.max 300.0 58 | E.indicator do 59 | E.name "PM2.5" 60 | E.max 250.0 61 | E.indicator do 62 | E.name "PM10" 63 | E.max 300.0 64 | E.indicator do 65 | E.name "CO" 66 | E.max 5.0 67 | E.indicator do 68 | E.name "NO2" 69 | E.max 200.0 70 | E.indicator do 71 | E.name "SO2" 72 | E.max 100.0 73 | E.circleShape 74 | E.splitNumber 5 75 | E.radarName do 76 | E.textStyle do 77 | E.color $ C.rgba 238 197 102 1.0 78 | E.splitLine do 79 | E.lineStyle do 80 | E.rgbaColors 81 | [ C.rgba 238 197 102 1.0 82 | , C.rgba 238 197 102 0.8 83 | , C.rgba 238 197 102 0.6 84 | , C.rgba 238 197 102 0.4 85 | , C.rgba 238 197 102 0.2 86 | , C.rgba 238 197 102 0.1 87 | ] 88 | E.splitArea E.hidden 89 | E.axisLine do 90 | E.lineStyle $ E.rgbaColor $ C.rgba 238 197 102 0.5 91 | 92 | E.series do 93 | E.radarSeries do 94 | E.name "Beijing" 95 | E.lineStylePair lineStyle 96 | E.symbol ET.None 97 | E.itemStyle do 98 | E.normalItemStyle do 99 | F.for_ (C.fromHexString "#f9713c") E.color 100 | E.areaStylePair $ E.normalAreaStyle $ E.opacity 0.1 101 | E.buildItems do 102 | F.for_ dataBJ (E.addItem <<< E.values) 103 | E.radarSeries do 104 | E.name "Shanghai" 105 | E.lineStylePair lineStyle 106 | E.symbol ET.None 107 | E.itemStyle $ E.normalItemStyle $ F.for_ (C.fromHexString "#B3E4A1") E.color 108 | E.areaStylePair $ E.normalAreaStyle $ E.opacity 0.05 109 | E.buildItems do 110 | F.for_ dataSH (E.addItem <<< E.values) 111 | E.radarSeries do 112 | E.name "Guanzhou" 113 | E.lineStylePair lineStyle 114 | E.symbol ET.None 115 | E.itemStyle $ E.normalItemStyle $ E.rgbaColor $ C.rgba 238 197 102 1.0 116 | E.areaStylePair $ E.normalAreaStyle $ E.opacity 0.05 117 | E.buildItems do 118 | F.for_ dataGZ (E.addItem <<< E.values) 119 | 120 | chart ∷ ∀ e. Eff (dom ∷ DOM, echarts ∷ ET.ECHARTS, exception ∷ EXCEPTION|e) Unit 121 | chart = do 122 | mbEl ← U.getElementById $ ElementId "radar" 123 | case mbEl of 124 | Nothing → DT.traceAnyA "There is no element with 'radar' id" 125 | Just el → do 126 | ch ← EC.init el 127 | EC.setOption (interpret options) ch 128 | 129 | dataBJ ∷ Array (Array Number) 130 | dataBJ = 131 | [ [55.0, 9.0, 56.0, 0.46, 18.0, 6.0, 1.0] 132 | , [25.0, 11.0, 21.0, 0.65, 34.0, 9.0, 2.0] 133 | , [56.0, 7.0, 63.0, 0.3, 14.0, 5.0, 3.0] 134 | , [33.0, 7.0, 29.0, 0.33, 16.0, 6.0, 4.0] 135 | , [42.0, 24.0, 44.0, 0.76, 40.0, 16.0, 5.0] 136 | , [82.0, 58.0, 90.0, 1.77, 68.0, 33.0, 6.0] 137 | , [74.0, 49.0, 77.0, 1.46, 48.0, 27.0, 7.0] 138 | , [78.0, 55.0, 80.0, 1.29, 59.0, 29.0, 8.0] 139 | , [267.0, 216.0, 280.0, 4.8, 108.0, 64.0, 9.0] 140 | , [185.0, 127.0, 216.0, 2.52, 61.0, 27.0, 10.0] 141 | , [39.0, 19.0, 38.0, 0.57, 31.0, 15.0, 11.0] 142 | , [41.0, 11.0, 40.0, 0.43, 21.0, 7.0, 12.0] 143 | , [64.0, 38.0, 74.0, 1.04, 46.0, 22.0, 13.0] 144 | , [108.0, 79.0, 120.0, 1.7, 75.0, 41.0, 14.0] 145 | , [108.0, 63.0, 116.0, 1.48, 44.0, 26.0, 15.0] 146 | , [33.0, 6.0, 29.0, 0.34, 13.0, 5.0, 16.0] 147 | , [94.0, 66.0, 110.0, 1.54, 62.0, 31.0, 17.0] 148 | , [186.0, 142.0, 192.0, 3.88, 93.0, 79.0, 18.0] 149 | , [57.0, 31.0, 54.0, 0.96, 32.0, 14.0, 19.0] 150 | , [22.0, 8.0, 17.0, 0.48, 23.0, 10.0, 20.0] 151 | , [39.0, 15.0, 36.0, 0.61, 29.0, 13.0, 21.0] 152 | , [94.0, 69.0, 114.0, 2.08, 73.0, 39.0, 22.0] 153 | , [99.0, 73.0, 110.0, 2.43, 76.0, 48.0, 23.0] 154 | , [31.0, 12.0, 30.0, 0.5, 32.0, 16.0, 24.0] 155 | , [42.0, 27.0, 43.0, 1.0, 53.0, 22.0, 25.0] 156 | , [154.0, 117.0, 157.0, 3.05, 92.0, 58.0, 26.0] 157 | , [234.0, 185.0, 230.0, 4.09, 123.0, 69.0, 27.0] 158 | , [160.0, 120.0, 186.0, 2.77, 91.0, 50.0, 28.0] 159 | , [134.0, 96.0, 165.0, 2.76, 83.0, 41.0, 29.0] 160 | , [52.0, 24.0, 60.0, 1.03, 50.0, 21.0, 30.0] 161 | , [46.0, 5.0, 49.0, 0.28, 10.0, 6.0, 31.0] 162 | ] 163 | 164 | dataGZ ∷ Array (Array Number) 165 | dataGZ = 166 | [ [26.0, 37.0, 27.0, 1.163, 27.0, 13.0, 1.0] 167 | , [85.0, 62.0, 71.0, 1.195, 60.0, 8.0, 2.0] 168 | , [78.0, 38.0, 74.0, 1.363, 37.0, 7.0, 3.0] 169 | , [21.0, 21.0, 36.0, 0.634, 40.0, 9.0, 4.0] 170 | , [41.0, 42.0, 46.0, 0.915, 81.0, 13.0, 5.0] 171 | , [56.0, 52.0, 69.0, 1.067, 92.0, 16.0, 6.0] 172 | , [64.0, 30.0, 28.0, 0.924, 51.0, 2.0, 7.0] 173 | , [55.0, 48.0, 74.0, 1.236, 75.0, 26.0, 8.0] 174 | , [76.0, 85.0, 113.0, 1.237, 114.0, 27.0, 9.0] 175 | , [91.0, 81.0, 104.0, 1.041, 56.0, 40.0, 10.0] 176 | , [84.0, 39.0, 60.0, 0.964, 25.0, 11.0, 11.0] 177 | , [64.0, 51.0, 101.0, 0.862, 58.0, 23.0, 12.0] 178 | , [70.0, 69.0, 120.0, 1.198, 65.0, 36.0, 13.0] 179 | , [77.0, 105.0, 178.0, 2.549, 64.0, 16.0, 14.0] 180 | , [109.0, 68.0, 87.0, 0.996, 74.0, 29.0, 15.0] 181 | , [73.0, 68.0, 97.0, 0.905, 51.0, 34.0, 16.0] 182 | , [54.0, 27.0, 47.0, 0.592, 53.0, 12.0, 17.0] 183 | , [51.0, 61.0, 97.0, 0.811, 65.0, 19.0, 18.0] 184 | , [91.0, 71.0, 121.0, 1.374, 43.0, 18.0, 19.0] 185 | , [73.0, 102.0, 182.0, 2.787, 44.0, 19.0, 20.0] 186 | , [73.0, 50.0, 76.0, 0.717, 31.0, 20.0, 21.0] 187 | , [84.0, 94.0, 140.0, 2.238, 68.0, 18.0, 22.0] 188 | , [93.0, 77.0, 104.0, 1.165, 53.0, 7.0, 23.0] 189 | , [99.0, 130.0, 227.0, 3.97, 55.0, 15.0, 24.0] 190 | , [146.0, 84.0, 139.0, 1.094, 40.0, 17.0, 25.0] 191 | , [113.0, 108.0, 137.0, 1.481, 48.0, 15.0, 26.0] 192 | , [81.0, 48.0, 62.0, 1.619, 26.0, 3.0, 27.0] 193 | , [56.0, 48.0, 68.0, 1.336, 37.0, 9.0, 28.0] 194 | , [82.0, 92.0, 174.0, 3.29, 0.0, 13.0, 29.0] 195 | , [106.0, 116.0, 188.0, 3.628, 101.0, 16.0, 30.0] 196 | , [118.0, 50.0, 0.0, 1.383, 76.0, 11.0, 31.0] 197 | ] 198 | 199 | dataSH ∷ Array (Array Number) 200 | dataSH = 201 | [ [91.0, 45.0, 125.0, 0.82, 34.0, 23.0, 1.0] 202 | , [65.0, 27.0, 78.0, 0.86, 45.0, 29.0, 2.0] 203 | , [83.0, 60.0, 84.0, 1.09, 73.0, 27.0, 3.0] 204 | , [109.0, 81.0, 121.0, 1.28, 68.0, 51.0, 4.0] 205 | , [106.0, 77.0, 114.0, 1.07, 55.0, 51.0, 5.0] 206 | , [109.0, 81.0, 121.0, 1.28, 68.0, 51.0, 6.0] 207 | , [106.0, 77.0, 114.0, 1.07, 55.0, 51.0, 7.0] 208 | , [89.0, 65.0, 78.0, 0.86, 51.0, 26.0, 8.0] 209 | , [53.0, 33.0, 47.0, 0.64, 50.0, 17.0, 9.0] 210 | , [80.0, 55.0, 80.0, 1.01, 75.0, 24.0, 10.0] 211 | , [117.0, 81.0, 124.0, 1.03, 45.0, 24.0, 11.0] 212 | , [99.0, 71.0, 142.0, 1.1, 62.0, 42.0, 12.0] 213 | , [95.0, 69.0, 130.0, 1.28, 74.0, 50.0, 13.0] 214 | , [116.0, 87.0, 131.0, 1.47, 84.0, 40.0, 14.0] 215 | , [108.0, 80.0, 121.0, 1.3, 85.0, 37.0, 15.0] 216 | , [134.0, 83.0, 167.0, 1.16, 57.0, 43.0, 16.0] 217 | , [79.0, 43.0, 107.0, 1.05, 59.0, 37.0, 17.0] 218 | , [71.0, 46.0, 89.0, 0.86, 64.0, 25.0, 18.0] 219 | , [97.0, 71.0, 113.0, 1.17, 88.0, 31.0, 19.0] 220 | , [84.0, 57.0, 91.0, 0.85, 55.0, 31.0, 20.0] 221 | , [87.0, 63.0, 101.0, 0.9, 56.0, 41.0, 21.0] 222 | , [104.0, 77.0, 119.0, 1.09, 73.0, 48.0, 22.0] 223 | , [87.0, 62.0, 100.0, 1.72, 28.0, 23.0] 224 | , [168.0, 128.0, 172.0, 1.49, 97.0, 56.0, 24.0] 225 | , [65.0, 45.0, 51.0, 0.74, 39.0, 17.0, 25.0] 226 | , [39.0, 24.0, 38.0, 0.61, 47.0, 17.0, 26.0] 227 | , [39.0, 24.0, 39.0, 0.59, 50.0, 19.0, 27.0] 228 | , [93.0, 68.0, 96.0, 1.05, 79.0, 29.0, 28.0] 229 | , [188.0, 143.0, 197.0, 1.66, 99.0, 51.0, 29.0] 230 | , [174.0, 131.0, 174.0, 1.55, 108.0, 50.0, 30.0] 231 | , [187.0, 143.0, 201.0, 1.39, 89.0, 53.0, 31.0] 232 | ] 233 | -------------------------------------------------------------------------------- /example/src/Scatter.purs: -------------------------------------------------------------------------------- 1 | module Scatter where 2 | 3 | import Prelude 4 | 5 | import Control.Monad.Eff (Eff) 6 | import Control.Monad.Eff.Exception (EXCEPTION) 7 | import Control.Monad.Eff.Random (RANDOM) 8 | import Data.Array (zipWith) 9 | import Data.Maybe (Maybe(..), maybe) 10 | import Data.NonEmpty as NE 11 | import Data.Tuple (Tuple(..), uncurry) 12 | import Debug.Trace as DT 13 | import DOM (DOM) 14 | import DOM.Node.Types (ElementId(..)) 15 | import ECharts.Chart as EC 16 | import ECharts.Theme as ETheme 17 | import ECharts.Types as ET 18 | import ECharts.Types.Phantom as ETP 19 | import ECharts.Commands as E 20 | import ECharts.Monad (DSL', interpret) 21 | import Math (cos, sin, (%)) 22 | import Utils as U 23 | 24 | genSinData ∷ ∀ e. Eff (random ∷ RANDOM|e) (Array ET.Item) 25 | genSinData = do 26 | randomIs ← map NE.oneOf $ U.randomArray 10000 27 | randomXs ← map NE.oneOf $ U.randomArray 10000 28 | 29 | let 30 | randoms = 31 | zipWith (\i x → Tuple (U.precise 3.0 $ i * 10.0) x) randomIs randomXs 32 | mapfn (Tuple i rnd) = 33 | uncurry ET.pairItem 34 | $ Tuple i (U.precise 3.0 $ sin i - i * (if i `mod` 2.0 > 0.0 then 0.1 else -0.1) * rnd) 35 | pure $ map mapfn randoms 36 | 37 | genCosData ∷ ∀ e. Eff (random ∷ RANDOM|e) (Array ET.Item) 38 | genCosData = do 39 | randomIs ← map NE.oneOf $ U.randomArray 10000 40 | randomXs ← map NE.oneOf $ U.randomArray 10000 41 | let 42 | randoms = 43 | zipWith (\i x → Tuple (U.precise 3.0 $ i * 10.0) x) randomIs randomXs 44 | mapfn (Tuple i rnd) = 45 | uncurry ET.pairItem 46 | $ Tuple i (U.precise 3.0 $ cos i - i * (if i % 2.0 > 0.0 then 0.1 else -0.1) * rnd) 47 | pure $ map mapfn randoms 48 | 49 | options ∷ Array ET.Item → Array ET.Item → DSL' ETP.OptionI 50 | options sinData cosData = do 51 | E.title do 52 | E.text "SIN and COS random scatter" 53 | 54 | E.tooltip do 55 | E.trigger ET.AxisTrigger 56 | E.showDelay 0.0 57 | E.axisPointer do 58 | E.shown 59 | E.pointerType ET.CrossPointer 60 | E.lineStyle do 61 | E.lineType ET.DashedLine 62 | E.width 1 63 | E.zlevel 1 64 | 65 | E.legend do 66 | E.items $ map ET.strItem [ "sin", "cos" ] 67 | 68 | E.xAxis do 69 | E.axisType ET.Value 70 | E.scale true 71 | 72 | E.yAxis do 73 | E.axisType ET.Value 74 | E.scale true 75 | 76 | E.series do 77 | E.scatter do 78 | E.markPoint do 79 | E.label $ E.normal $ E.shown 80 | E.buildItems $ E.addItem do 81 | E.buildCoord do 82 | E.coordXValue "6.0" 83 | E.coordY "1.3" 84 | E.symbolSize 30 85 | E.symbol ET.Rect 86 | 87 | E.name "sin" 88 | E.large true 89 | E.symbolSize 3 90 | E.items sinData 91 | 92 | E.scatter do 93 | E.name "cos" 94 | E.large true 95 | E.symbolSize 2 96 | E.items cosData 97 | 98 | E.dataZoom do 99 | E.sliderDataZoom E.shown 100 | E.insideDataZoom $ pure unit 101 | 102 | chart ∷ ∀ e. Eff (dom ∷ DOM, echarts ∷ ET.ECHARTS, exception ∷ EXCEPTION, random ∷ RANDOM|e) Unit 103 | chart = do 104 | chart' (ElementId "scatter-1") Nothing 105 | chart' (ElementId "scatter-2") (Just (ETheme.dark)) 106 | chart' (ElementId "scatter-3") (Just (ETheme.macarons)) 107 | 108 | chart' ∷ ∀ e. ElementId → Maybe ETheme.Theme → Eff (dom ∷ DOM, echarts ∷ ET.ECHARTS, exception ∷ EXCEPTION, random ∷ RANDOM|e) Unit 109 | chart' id theme = do 110 | mbEl ← U.getElementById id 111 | case mbEl of 112 | Nothing → DT.traceAnyA "There is no element with scatter id" 113 | Just el → do 114 | ch ← maybe EC.init EC.initWithTheme theme el 115 | sinData ← genSinData 116 | cosData ← genCosData 117 | EC.setOption (interpret $ options sinData cosData) ch 118 | -------------------------------------------------------------------------------- /example/src/Utils.js: -------------------------------------------------------------------------------- 1 | exports.randomArrayImpl = function(NonEmpty) { 2 | return function(count) { 3 | return function() { 4 | if (count < 1) count = 1; 5 | var Math = window['Math']; 6 | var result = []; 7 | for (var i = 0; i < count; i++) { 8 | result.push(Math.random()); 9 | } 10 | result.unshift(); 11 | return NonEmpty(Math.random())(result); 12 | }; 13 | }; 14 | }; 15 | -------------------------------------------------------------------------------- /example/src/Utils.purs: -------------------------------------------------------------------------------- 1 | module Utils 2 | ( randomInArray 3 | , getElementById 4 | , randomArray 5 | , precise 6 | , onLoad 7 | ) where 8 | 9 | import Prelude 10 | 11 | import Control.Monad.Eff (Eff) 12 | import Control.Monad.Eff.Random (RANDOM, random) 13 | import Control.Monad.Except (runExcept) 14 | 15 | import Data.Array ((!!), length) 16 | import Data.Int as Int 17 | import Data.Maybe (Maybe(..), fromJust) 18 | import Data.Either (either) 19 | import Data.Tuple (Tuple(..)) 20 | import Data.Foreign (toForeign) 21 | import Data.NonEmpty as NE 22 | 23 | import DOM (DOM) 24 | import DOM.Event.EventTarget (eventListener, addEventListener) 25 | import DOM.HTML (window) 26 | import DOM.HTML.Event.EventTypes (load) 27 | import DOM.HTML.Types (HTMLElement, windowToEventTarget, htmlDocumentToNonElementParentNode, readHTMLElement) 28 | import DOM.HTML.Window (document) 29 | import DOM.Node.NonElementParentNode as NEPN 30 | import DOM.Node.Types (ElementId) 31 | 32 | import Math (round, pow) 33 | import Partial.Unsafe (unsafePartial) 34 | 35 | getElementById 36 | ∷ ∀ eff 37 | . ElementId 38 | → Eff (dom ∷ DOM | eff) (Maybe HTMLElement) 39 | getElementById elementId = do 40 | win ← window 41 | doc ← document win 42 | el ← NEPN.getElementById elementId (htmlDocumentToNonElementParentNode doc) 43 | pure $ either (const Nothing) Just $ runExcept $ readHTMLElement (toForeign <<< unsafePartial fromJust $ el) 44 | 45 | onLoad 46 | ∷ ∀ eff a 47 | . Eff (dom ∷ DOM | eff) a 48 | → Eff (dom ∷ DOM | eff) Unit 49 | onLoad handler = 50 | addEventListener load (eventListener (const handler)) false 51 | <<< windowToEventTarget 52 | =<< window 53 | 54 | precise ∷ Number → Number → Number 55 | precise pre num = 56 | (round $ (pow 10.0 pre) * num) / (pow 10.0 pre) 57 | 58 | foreign import randomArrayImpl 59 | ∷ ∀ e a 60 | . (a → Array a → NE.NonEmpty Array a) 61 | → Int 62 | → Eff (random ∷ RANDOM|e) (NE.NonEmpty Array Number) 63 | 64 | randomArray ∷ ∀ e. Int → Eff (random ∷ RANDOM|e) (NE.NonEmpty Array Number) 65 | randomArray = randomArrayImpl NE.NonEmpty 66 | 67 | randomInArray 68 | ∷ ∀ a e 69 | . NE.NonEmpty Array a 70 | → Eff (random ∷ RANDOM|e) (Tuple a Int) 71 | randomInArray nelst = do 72 | rnd ← random 73 | let 74 | lst = NE.oneOf nelst 75 | l = length lst 76 | i = Int.floor (rnd * Int.toNumber l) 77 | pure $ case lst !! i of 78 | Nothing → Tuple (NE.head nelst) 0 79 | Just x → Tuple x i 80 | -------------------------------------------------------------------------------- /helpers.js: -------------------------------------------------------------------------------- 1 | var data = [ {name: "Beijing", value: 12}, 2 | {name: "Tianjin", value: 12}, 3 | {name: "Shanghai", value: 12}, 4 | {name: "Chongqing", value: 12}, 5 | {name: "Hebei", value: 12}, 6 | {name: "Henan", value: 12}, 7 | {name: "Yunnan", value: 12}, 8 | {name: "Liaoning", value: 12}, 9 | {name: "Heilongjiang", value: 12}, 10 | {name: "Hunan", value: 12}, 11 | {name: "Anhui", value: 12}, 12 | {name: "Shandong", value: 12}, 13 | {name: "Xinjiang", value: 12}, 14 | {name: "Jiangsu Province", value: 12}, 15 | {name: "Zhejiang", value: 12}, 16 | {name: "Jiangxi", value: 12}, 17 | {name: "Hubei", value: 12}, 18 | {name: "Guangxi", value: 12}, 19 | {name: "Gansu", value: 12}, 20 | {name: "Shanxi", value: 12}, 21 | {name: "Inner", value: 12}, 22 | {name: "Shaanxi", value: 12}, 23 | {name: "Jilin", value: 12}, 24 | {name: "Fujian", value: 12}, 25 | {name: "Guizhou", value: 12}, 26 | {name: "Guangdong", value: 12}, 27 | {name: "Qinghai", value: 12}, 28 | {name: "Tibet", value: 12}, 29 | {name: "Sichuan", value: 12}, 30 | {name: "Ningxia", value: 12}, 31 | {name: "Hainan", value: 12}, 32 | {name: "Taiwan", value: 12}, 33 | {name: "Hong Kong", value: 12}, 34 | {name: "Macau", value: 12} 35 | ]; 36 | var strings = "" 37 | for (var i = 0 ; i < data.length; i++) { 38 | var datum = data[i]; 39 | var randomX = Math.random() * 3; 40 | var randomY = Math.random() * 5; 41 | var x = 100 + randomX; 42 | var y = 34 + randomY; 43 | strings += "Tuple \"" + datum.name + "\" (Tuple " + x.toFixed(4) + " " + y.toFixed(4) + "),\n"; 44 | } 45 | 46 | console.log(strings); 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "purescript-echarts", 3 | "private": true, 4 | "devDependencies": { 5 | "echarts": "cryogenian/echarts#item-value-unshift-prebuild", 6 | "express": "^4.16.1" 7 | }, 8 | "scripts": { 9 | "build": "pulp browserify --include example/src --to public/build.js", 10 | "serve": "node script/serve.js", 11 | "ide": "purs ide server" 12 | }, 13 | "dependencies": { 14 | "pulp": "^12.0.1", 15 | "purescript": "^0.11.6", 16 | "purescript-psa": "^0.5.1" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /public/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slamdata/purescript-echarts/502deae5847eeaa8100aa34648c725efed60c532/public/images/logo.png -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | purescript-echarts examples 6 | 7 | 8 | 9 | 20 | 21 | 22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | 49 | 50 | -------------------------------------------------------------------------------- /script/serve.js: -------------------------------------------------------------------------------- 1 | var express = require("express"), 2 | http = require("http"); 3 | 4 | var runServer = function(taskName, serverPort, subdirectory) { 5 | if (taskName === undefined) { 6 | taskName = "serve"; 7 | } 8 | if (serverPort === undefined) { 9 | serverPort = 5050; 10 | } 11 | if (subdirectory === undefined) { 12 | subdirectory = "public"; 13 | } 14 | var app = express(); 15 | app.use(express.static(__dirname + '/../' + subdirectory)); 16 | app.use("/lib", express.static(__dirname + '/../bower_components')); 17 | 18 | 19 | app.listen(serverPort); 20 | console.log('Started listening to port: ' + serverPort) 21 | }; 22 | 23 | runServer(); 24 | -------------------------------------------------------------------------------- /src/ECharts.purs: -------------------------------------------------------------------------------- 1 | module ECharts where 2 | -------------------------------------------------------------------------------- /src/ECharts/Chart.js: -------------------------------------------------------------------------------- 1 | var echarts = require("echarts"); 2 | 3 | exports.initImpl = function(theme) { 4 | return function(el) { 5 | return function() { 6 | return echarts.init(el, theme); 7 | }; 8 | }; 9 | }; 10 | 11 | function isObject(o) { 12 | return null != o && 13 | typeof o === 'object' && 14 | Object.prototype.toString.call(o) === '[object Object]'; 15 | } 16 | 17 | exports.registerTheme = function(name) { 18 | return function(theme) { 19 | return function() { 20 | // if value is not `undefined` and is not of type `string` then it must be `Foreign` for which we only permit plain Objects. 21 | if (theme !== undefined && typeof theme !== 'string' && !isObject(theme)) { 22 | throw new TypeError('Theme must be an Object'); 23 | } 24 | echarts.registerTheme(name, theme); 25 | }; 26 | }; 27 | }; 28 | 29 | exports.setOptionImpl = function(option) { 30 | return function(chart) { 31 | return function() { 32 | try { 33 | chart.setOption(option, false, false); 34 | } catch (e) { 35 | console.error(e); 36 | } 37 | }; 38 | }; 39 | }; 40 | 41 | exports.resetOptionImpl = function(option) { 42 | return function(chart) { 43 | return function() { 44 | try { 45 | chart.setOption(option, true, false); 46 | } catch (e) { 47 | console.error(e); 48 | } 49 | }; 50 | }; 51 | }; 52 | 53 | exports.resizeImpl = function(chart) { 54 | return function() { 55 | chart.resize(); 56 | return {}; 57 | }; 58 | }; 59 | 60 | exports.clearImpl = function(chart) { 61 | return function() { 62 | chart.clear(); 63 | return {}; 64 | }; 65 | }; 66 | 67 | exports.disposeImpl = function(chart) { 68 | return function() { 69 | chart.dispose(); 70 | return {}; 71 | }; 72 | }; 73 | 74 | exports.getOptionImpl = function(chart) { 75 | return function() { 76 | return chart.getOption(); 77 | }; 78 | }; 79 | -------------------------------------------------------------------------------- /src/ECharts/Chart.purs: -------------------------------------------------------------------------------- 1 | module ECharts.Chart 2 | ( init 3 | , initWithTheme 4 | , registerTheme 5 | , setOption 6 | , resetOption 7 | , resize 8 | , dispose 9 | , clear 10 | , getOption 11 | ) where 12 | 13 | import Prelude 14 | 15 | import Control.Monad.Eff (Eff) 16 | import Control.Monad.Eff.Class (class MonadEff, liftEff) 17 | import Control.Monad.Eff.Exception (EXCEPTION) 18 | import Data.Either (either) 19 | import Data.Foreign (Foreign, toForeign) 20 | import DOM (DOM) 21 | import DOM.HTML.Types (HTMLElement) 22 | import ECharts.Internal (undefinedValue) 23 | import ECharts.Theme (Theme, builtInThemeName) 24 | import ECharts.Types (Chart, ECHARTS, Option) 25 | 26 | foreign import initImpl 27 | ∷ ∀ e. Foreign 28 | → HTMLElement 29 | → Eff (dom ∷ DOM, echarts ∷ ECHARTS, exception ∷ EXCEPTION|e) Chart 30 | 31 | init 32 | ∷ ∀ m e 33 | . MonadEff (dom ∷ DOM, echarts ∷ ECHARTS, exception ∷ EXCEPTION|e) m 34 | ⇒ HTMLElement 35 | → m Chart 36 | init el = liftEff $ initImpl undefinedValue el 37 | 38 | initWithTheme 39 | ∷ ∀ m e 40 | . MonadEff (dom ∷ DOM, echarts ∷ ECHARTS, exception ∷ EXCEPTION|e) m 41 | ⇒ Theme 42 | → HTMLElement 43 | → m Chart 44 | initWithTheme theme el = 45 | liftEff $ initImpl (either (toForeign <<< builtInThemeName) toForeign theme) el 46 | 47 | foreign import registerTheme 48 | ∷ ∀ e. String 49 | → Foreign 50 | → Eff (echarts ∷ ECHARTS|e) Unit 51 | 52 | foreign import setOptionImpl 53 | ∷ ∀ e. Option → Chart → Eff (echarts ∷ ECHARTS, exception ∷ EXCEPTION|e) Unit 54 | 55 | setOption 56 | ∷ ∀ m e 57 | . MonadEff (echarts ∷ ECHARTS, exception ∷ EXCEPTION|e) m 58 | ⇒ Option 59 | → Chart 60 | → m Unit 61 | setOption opts chart = liftEff $ setOptionImpl opts chart 62 | 63 | 64 | foreign import resetOptionImpl 65 | ∷ ∀ e. Option → Chart → Eff (echarts ∷ ECHARTS, exception ∷ EXCEPTION|e) Unit 66 | 67 | 68 | resetOption 69 | ∷ ∀ m e 70 | . MonadEff (echarts ∷ ECHARTS, exception ∷ EXCEPTION|e) m 71 | ⇒ Option 72 | → Chart 73 | → m Unit 74 | resetOption opts chart = liftEff $ resetOptionImpl opts chart 75 | 76 | 77 | foreign import resizeImpl 78 | ∷ ∀ e. Chart → Eff (echarts ∷ ECHARTS|e) Unit 79 | 80 | resize 81 | ∷ ∀ m e 82 | . MonadEff (echarts ∷ ECHARTS|e) m 83 | ⇒ Chart 84 | → m Unit 85 | resize chart = liftEff $ resizeImpl chart 86 | 87 | 88 | foreign import clearImpl 89 | ∷ ∀ e. Chart → Eff (echarts ∷ ECHARTS|e) Unit 90 | 91 | clear 92 | ∷ ∀ m e 93 | . MonadEff (echarts ∷ ECHARTS|e) m 94 | ⇒ Chart 95 | → m Unit 96 | clear chart = liftEff $ clearImpl chart 97 | 98 | foreign import disposeImpl 99 | ∷ ∀ e. Chart → Eff (echarts ∷ ECHARTS|e) Unit 100 | 101 | dispose 102 | ∷ ∀ m e 103 | . MonadEff (echarts ∷ ECHARTS|e) m 104 | ⇒ Chart 105 | → m Unit 106 | dispose chart = liftEff $ disposeImpl chart 107 | 108 | foreign import getOptionImpl 109 | ∷ ∀ e. Chart → Eff (echarts ∷ ECHARTS|e) Foreign 110 | 111 | getOption 112 | ∷ ∀ m e 113 | . MonadEff (echarts ∷ ECHARTS|e) m 114 | ⇒ Chart 115 | → m Foreign 116 | getOption chart = liftEff $ getOptionImpl chart 117 | -------------------------------------------------------------------------------- /src/ECharts/Commands.purs: -------------------------------------------------------------------------------- 1 | module ECharts.Commands where 2 | 3 | import Prelude 4 | 5 | import Color as C 6 | import Data.Array as Arr 7 | import Data.Date (Date, year, month, day) 8 | import Data.Enum (fromEnum) 9 | import Data.Traversable as F 10 | import Data.Tuple (Tuple(..), snd, fst) 11 | import Data.Foreign (toForeign, Foreign) 12 | import ECharts.Monad (CommandsT, DSL, set, buildObj, buildSeries, buildArr, get, lastWithKeys, set') 13 | import ECharts.Types as T 14 | import ECharts.Types.Phantom (I, R) 15 | import ECharts.Types.Phantom as TP 16 | import ECharts.Internal (undefinedValue) 17 | 18 | series ∷ ∀ i m. Monad m ⇒ CommandsT TP.SeriesI m ~> CommandsT (series ∷ I|i) m 19 | series a = set "series" =<< buildSeries a 20 | 21 | tooltip ∷ ∀ i m. Monad m ⇒ CommandsT TP.TooltipI m ~> CommandsT (tooltip ∷ I|i) m 22 | tooltip a = set "tooltip" =<< buildObj a 23 | 24 | grids ∷ ∀ i m. Monad m ⇒ CommandsT TP.GridsI m ~> CommandsT (grid ∷ I|i) m 25 | grids = set "grid" <=< buildArr 26 | 27 | grid ∷ ∀ i m. Monad m ⇒ CommandsT TP.GridI m ~> CommandsT (grid ∷ I|i) m 28 | grid a = set "grid" =<< buildObj a 29 | 30 | polar ∷ ∀ i m. Monad m ⇒ CommandsT TP.PolarI m ~> CommandsT (polar ∷ I|i) m 31 | polar a = set "polar" =<< buildObj a 32 | 33 | legend ∷ ∀ i m. Monad m ⇒ CommandsT TP.LegendI m ~> CommandsT (legend ∷ I|i) m 34 | legend a = set "legend" =<< buildObj a 35 | 36 | xAxis ∷ ∀ i m. Monad m ⇒ CommandsT TP.XAxisI m ~> CommandsT (xAxis ∷ I|i) m 37 | xAxis a = set "xAxis" =<< buildObj a 38 | 39 | yAxis ∷ ∀ i m. Monad m ⇒ CommandsT TP.YAxisI m ~> CommandsT (yAxis ∷ I|i) m 40 | yAxis a = set "yAxis" =<< buildObj a 41 | 42 | radiusAxis ∷ ∀ i m. Monad m ⇒ CommandsT TP.RadiusAxisI m ~> CommandsT (radiusAxis ∷ I|i) m 43 | radiusAxis a = set "radiusAxis" =<< buildObj a 44 | 45 | angleAxis ∷ ∀ i m. Monad m ⇒ CommandsT TP.AngleAxisI m ~> CommandsT (angleAxis ∷ I|i) m 46 | angleAxis a = set "angleAxis" =<< buildObj a 47 | 48 | color ∷ ∀ i m. Monad m ⇒ C.Color → DSL (color ∷ I|i) m 49 | color a = set' "color" $ toForeign $ C.toHexString a 50 | 51 | colors ∷ ∀ i f m. Monad m ⇒ F.Foldable f ⇒ f C.Color → DSL (color ∷ I|i) m 52 | colors a = set' "color" $ toForeign $ F.foldMap (Arr.singleton <<< C.toHexString) a 53 | 54 | rgbaColors ∷ ∀ i f m. Monad m ⇒ F.Foldable f ⇒ f C.Color → DSL (color ∷ I|i) m 55 | rgbaColors a = set' "color" $ toForeign $ F.foldMap (Arr.singleton <<< C.cssStringRGBA) a 56 | 57 | rgbaColor ∷ ∀ i m. Monad m ⇒ C.Color → DSL (color ∷ I|i) m 58 | rgbaColor a = set' "color" $ toForeign $ C.cssStringRGBA a 59 | 60 | backgroundColor ∷ ∀ i m. Monad m ⇒ C.Color → DSL (backgroundColor ∷ I|i) m 61 | backgroundColor a = set' "backgroundColor" $ toForeign $ C.toHexString a 62 | 63 | visible ∷ ∀ i m. Monad m ⇒ Boolean → DSL (show ∷ I|i) m 64 | visible a = set' "show" $ toForeign a 65 | 66 | shown ∷ ∀ i m. Monad m ⇒ DSL (show ∷ I|i) m 67 | shown = visible true 68 | 69 | hidden ∷ ∀ i m. Monad m ⇒ DSL (show ∷ I|i) m 70 | hidden = visible false 71 | 72 | showTitle ∷ ∀ i m. Monad m ⇒ Boolean → DSL (showTitle ∷ I|i) m 73 | showTitle a = set' "showTitle" $ toForeign a 74 | 75 | textStyle ∷ ∀ i m. Monad m ⇒ CommandsT TP.TextStyleI m ~> CommandsT (textStyle ∷ I|i) m 76 | textStyle a = set "textStyle" =<< buildObj a 77 | 78 | subtextStyle ∷ ∀ i m. Monad m ⇒ CommandsT TP.TextStyleI m ~> CommandsT (subtextStyle ∷ I|i) m 79 | subtextStyle a = set "subtextStyle" =<< buildObj a 80 | 81 | left ∷ ∀ i m. Monad m ⇒ T.PixelOrPercent → DSL (left ∷ I|i) m 82 | left a = set' "left" $ T.pixelOrPercentToForeign a 83 | 84 | right ∷ ∀ i m. Monad m ⇒ T.PixelOrPercent → DSL (right ∷ I|i) m 85 | right a = set' "right" $ T.pixelOrPercentToForeign a 86 | 87 | top ∷ ∀ i m. Monad m ⇒ T.PixelOrPercent → DSL (top ∷ I|i) m 88 | top a = set' "top" $ T.pixelOrPercentToForeign a 89 | 90 | topTop ∷ ∀ i m. Monad m ⇒ DSL (top ∷ I|i) m 91 | topTop = set' "top" $ toForeign "top" 92 | 93 | topMiddle ∷ ∀ i m. Monad m ⇒ DSL (top ∷ I|i) m 94 | topMiddle = set' "top" $ toForeign "middle" 95 | 96 | topBottom ∷ ∀ i m. Monad m ⇒ DSL (top ∷ I|i) m 97 | topBottom = set' "top" $ toForeign "bottom" 98 | 99 | bottom ∷ ∀ i m. Monad m ⇒ T.PixelOrPercent → DSL (bottom ∷ I|i) m 100 | bottom a = set' "bottom" $ T.pixelOrPercentToForeign a 101 | 102 | bottomPx ∷ ∀ i m. Monad m ⇒ Int → DSL (bottom ∷ I|i) m 103 | bottomPx = set' "bottom" <<< toForeign 104 | 105 | orient ∷ ∀ i m. Monad m ⇒ T.Orient → DSL (orient ∷ I|i) m 106 | orient a = set' "orient" $ T.orientToForeign a 107 | 108 | items ∷ ∀ i f m. Monad m ⇒ F.Foldable f ⇒ f T.Item → DSL (items ∷ I|i) m 109 | items a = set' "data" $ toForeign $ F.foldMap (Arr.singleton <<< toForeign) a 110 | 111 | itemsDSL 112 | ∷ ∀ i f m a 113 | . Monad m 114 | ⇒ F.Traversable f 115 | ⇒ f (CommandsT TP.ItemI m a) 116 | → CommandsT (items ∷ I|i) m (f a) 117 | itemsDSL a = do 118 | is ← F.for a $ buildObj 119 | set' "data" $ toForeign $ F.foldMap (Arr.singleton <<< snd) is 120 | pure $ map fst is 121 | 122 | 123 | addItem ∷ ∀ i m. Monad m ⇒ CommandsT TP.ItemI m ~> CommandsT (item ∷ I|i) m 124 | addItem = set "" <=< buildObj 125 | 126 | buildItems ∷ ∀ i m. Monad m ⇒ CommandsT TP.ItemsI m ~> CommandsT (items ∷ I|i) m 127 | buildItems = set "data" <=< buildArr 128 | 129 | buildMarkItems ∷ ∀ i m. Monad m ⇒ CommandsT TP.ItemsI m ~> CommandsT (markItems ∷ I|i) m 130 | buildMarkItems is = do 131 | Tuple a obj ← buildArr is 132 | set' "data" $ toForeign obj 133 | pure a 134 | 135 | calendarIndex ∷ ∀ i m. Monad m ⇒ Int → DSL (calendarIndex ∷ I|i) m 136 | calendarIndex i = set' "calendarIndex" $ toForeign i 137 | 138 | visibleContent ∷ ∀ i m. Monad m ⇒ Boolean → DSL (showContent ∷ I|i) m 139 | visibleContent a = set' "showContent" $ toForeign a 140 | 141 | showContent ∷ ∀ i m. Monad m ⇒ DSL (showContent ∷ I|i) m 142 | showContent = visibleContent true 143 | 144 | hideContent ∷ ∀ i m. Monad m ⇒ DSL (showContent ∷ I|i) m 145 | hideContent = visibleContent false 146 | 147 | alwaysShowContent ∷ ∀ i m. Monad m ⇒ Boolean → DSL (alwaysShowContent ∷ I|i) m 148 | alwaysShowContent a = set' "alwaysShowContent" $ toForeign a 149 | 150 | trigger ∷ ∀ i m. Monad m ⇒ T.TooltipTrigger → DSL (trigger ∷ I|i) m 151 | trigger a = set' "trigger" $ T.tooltipTriggerToForeign a 152 | 153 | triggerOnMouseMove ∷ ∀ i m. Monad m ⇒ DSL (triggerOn ∷ I|i) m 154 | triggerOnMouseMove = set' "triggerOn" $ toForeign "mousemove" 155 | 156 | triggerOnClick ∷ ∀ i m. Monad m ⇒ DSL (triggerOn ∷ I|i) m 157 | triggerOnClick = set' "triggerOn" $ toForeign "click" 158 | 159 | triggerAxis ∷ ∀ i m. Monad m ⇒ DSL (trigger ∷ I|i) m 160 | triggerAxis = set' "trigger" $ toForeign "axis" 161 | 162 | triggerItem ∷ ∀ i m. Monad m ⇒ DSL (trigger ∷ I|i) m 163 | triggerItem = set' "trigger" $ toForeign "item" 164 | 165 | triggerEvent ∷ ∀ i m. Monad m ⇒ Boolean → DSL (trigger ∷ I|i) m 166 | triggerEvent a = set' "triggerEvent" $ toForeign a 167 | 168 | pie ∷ ∀ i m. Monad m ⇒ CommandsT TP.PieSeriesI m ~> CommandsT (pie ∷ I|i) m 169 | pie = set "pie" <=< buildObj 170 | 171 | line ∷ ∀ i m. Monad m ⇒ CommandsT TP.LineSeriesI m ~> CommandsT (line ∷ I|i) m 172 | line = set "line" <=< buildObj 173 | 174 | bar ∷ ∀ i m. Monad m ⇒ CommandsT TP.BarSeriesI m ~> CommandsT (bar ∷ I|i) m 175 | bar = set "bar" <=< buildObj 176 | 177 | scatter ∷ ∀ i m. Monad m ⇒ CommandsT TP.ScatterI m ~> CommandsT (scatter ∷ I|i) m 178 | scatter = set "scatter" <=< buildObj 179 | 180 | effectScatter ∷ ∀ i m. Monad m ⇒ CommandsT TP.EffectScatterI m ~> CommandsT (effectScatter ∷ I|i) m 181 | effectScatter = set "effectScatter" <=< buildObj 182 | 183 | treeMap ∷ ∀ i m. Monad m ⇒ CommandsT TP.TreeMapI m ~> CommandsT (treeMap ∷ I|i) m 184 | treeMap = set "treemap" <=< buildObj 185 | 186 | boxPlot ∷ ∀ i m. Monad m ⇒ CommandsT TP.BoxPlotI m ~> CommandsT (boxPlot ∷ I|i) m 187 | boxPlot = set "boxplot" <=< buildObj 188 | 189 | candlestick ∷ ∀ i m. Monad m ⇒ CommandsT TP.CandlestickI m ~> CommandsT (candlestick ∷ I|i) m 190 | candlestick = set "candlestick" <=< buildObj 191 | 192 | heatMap ∷ ∀ i m. Monad m ⇒ CommandsT TP.HeatMapI m ~> CommandsT (heatMap ∷ I|i) m 193 | heatMap = set "heatmap" <=< buildObj 194 | 195 | calendarSpec ∷ ∀ i m. Monad m ⇒ CommandsT TP.CalendarSpecI m ~> CommandsT (calendarSpec ∷ I|i) m 196 | calendarSpec = set "calendar" <=< buildObj 197 | 198 | map_ ∷ ∀ i m. Monad m ⇒ CommandsT TP.MapI m ~> CommandsT (map ∷ I|i) m 199 | map_ = set "map" <=< buildObj 200 | 201 | parallels ∷ ∀ i m. Monad m ⇒ CommandsT TP.ParallelsI m ~> CommandsT (parallel ∷ I|i) m 202 | parallels = set "parallel" <=< buildArr 203 | 204 | parallel ∷ ∀ i m. Monad m ⇒ CommandsT TP.ParallelI m ~> CommandsT (parallel ∷ I|i) m 205 | parallel = set "parallel" <=< buildObj 206 | 207 | lines ∷ ∀ i m. Monad m ⇒ CommandsT TP.LinesI m ~> CommandsT (lines ∷ I|i) m 208 | lines = set "lines" <=< buildObj 209 | 210 | graph ∷ ∀ i m. Monad m ⇒ CommandsT TP.GraphI m ~> CommandsT (graph ∷ I|i) m 211 | graph = set "graph" <=< buildObj 212 | 213 | sankey ∷ ∀ i m. Monad m ⇒ CommandsT TP.SankeyI m ~> CommandsT (sankey ∷ I|i) m 214 | sankey = set "sankey" <=< buildObj 215 | 216 | funnel ∷ ∀ i m. Monad m ⇒ CommandsT TP.FunnelI m ~> CommandsT (funnel ∷ I|i) m 217 | funnel = set "funnel" <=< buildObj 218 | 219 | parallelSeries ∷ ∀ i m. Monad m ⇒ CommandsT TP.ParallelSeriesI m ~> CommandsT (parallelSeries ∷ I|i) m 220 | parallelSeries = set "parallel" <=< buildObj 221 | 222 | gauge ∷ ∀ i m. Monad m ⇒ CommandsT TP.GaugeI m ~> CommandsT (gauge ∷ I|i) m 223 | gauge = set "gauge" <=< buildObj 224 | 225 | radarSeries ∷ ∀ i m. Monad m ⇒ CommandsT TP.RadarSeriesI m ~> CommandsT (radarSeries ∷ I|i) m 226 | radarSeries = set "radar" <=< buildObj 227 | 228 | xAxisIndex ∷ ∀ i m. Monad m ⇒ Int → DSL (xAxisIndex ∷ I|i) m 229 | xAxisIndex a = set' "xAxisIndex" $ toForeign a 230 | 231 | yAxisIndex ∷ ∀ i m. Monad m ⇒ Int → DSL (yAxisIndex ∷ I|i) m 232 | yAxisIndex a = set' "yAxisIndex" $ toForeign a 233 | 234 | xAxisAllIndices ∷ ∀ i m. Monad m ⇒ DSL (xAxisIndex ∷ I|i) m 235 | xAxisAllIndices = set' "xAxisIndex" $ toForeign "all" 236 | 237 | yAxisAllIndices ∷ ∀ i m. Monad m ⇒ DSL (yAxisIndex ∷ I|i) m 238 | yAxisAllIndices = set' "yAxisIndex" $ toForeign "all" 239 | 240 | polarIndex ∷ ∀ i m. Monad m ⇒ Int → DSL (polarIndex ∷ I|i) m 241 | polarIndex a = set' "polarIndex" $ toForeign a 242 | 243 | symbol ∷ ∀ i m. Monad m ⇒ T.Symbol → DSL (symbol ∷ I|i) m 244 | symbol a = set' "symbol" $ T.symbolToForeign a 245 | 246 | symbolSize ∷ ∀ i m. Monad m ⇒ Int → DSL (symbolSize ∷ I|i) m 247 | symbolSize a = set' "symbolSize" $ toForeign a 248 | 249 | smooth ∷ ∀ i m. Monad m ⇒ Boolean → DSL (smooth ∷ I|i) m 250 | smooth a = set' "smooth" $ toForeign a 251 | 252 | name ∷ ∀ i m. Monad m ⇒ String → DSL (name ∷ I|i) m 253 | name a = set' "name" $ toForeign a 254 | 255 | stack ∷ ∀ i m. Monad m ⇒ String → DSL (stack ∷ I|i) m 256 | stack a = set' "stack" $ toForeign a 257 | 258 | center ∷ ∀ i m. Monad m ⇒ T.Point → DSL (center ∷ I|i) m 259 | center a = set' "center" $ T.pointToForeign a 260 | 261 | radius ∷ ∀ i m. Monad m ⇒ T.Radius → DSL (radius ∷ I|i) m 262 | radius a = set' "radius" $ T.radiusToForeign a 263 | 264 | singleValueRadius ∷ ∀ i m. Monad m ⇒ T.SingleValueRadius → DSL (radius ∷ I|i) m 265 | singleValueRadius a = set' "radius" $ T.singleValueRadiusToForeign a 266 | 267 | startAngle ∷ ∀ i m. Monad m ⇒ Number → DSL (startAngle ∷ I|i) m 268 | startAngle a = set' "startAngle" $ toForeign a 269 | 270 | axisTick ∷ ∀ i m. Monad m ⇒ CommandsT TP.AxisTickI m ~> CommandsT (axisTick ∷ I|i) m 271 | axisTick = set "axisTick" <=< buildObj 272 | 273 | axisLabel ∷ ∀ i m. Monad m ⇒ CommandsT TP.AxisLabelI m ~> CommandsT (axisLabel ∷ I|i) m 274 | axisLabel = set "axisLabel" <=< buildObj 275 | 276 | axisType ∷ ∀ i m. Monad m ⇒ T.AxisType → DSL (axisType ∷ I|i) m 277 | axisType a = set' "type" $ T.axisTypeToForeign a 278 | 279 | value ∷ ∀ i m. Monad m ⇒ Number → DSL (value ∷ I|i) m 280 | value a = set' "value" $ toForeign a 281 | 282 | values ∷ ∀ i f m. Monad m ⇒ F.Foldable f ⇒ f Number → DSL (value ∷ I|i) m 283 | values = set' "value" <<< toForeign <<< F.foldMap Arr.singleton 284 | 285 | buildValues ∷ ∀ i m. Monad m ⇒ CommandsT TP.ValuesI m ~> CommandsT (value ∷ I|i) m 286 | buildValues = set "value" <=< buildArr 287 | 288 | addValue ∷ ∀ i m. Monad m ⇒ Number → DSL (addValue ∷ I|i) m 289 | addValue = set' "" <<< toForeign 290 | 291 | addStringValue ∷ ∀ i m. Monad m ⇒ String → DSL (addValue ∷ I|i) m 292 | addStringValue = set' "" <<< toForeign 293 | 294 | autoValue ∷ ∀ i m. Monad m ⇒ DSL (addValue ∷ I|i) m 295 | autoValue = set' "" $ toForeign "auto" 296 | 297 | buildNames ∷ ∀ i m. Monad m ⇒ CommandsT TP.NamesI m ~> CommandsT (name ∷ I|i) m 298 | buildNames = set "name" <=< buildArr 299 | 300 | addName ∷ ∀ i m. Monad m ⇒ String → DSL (addName ∷ I|i) m 301 | addName = set' "" <<< toForeign 302 | 303 | missingValue ∷ ∀ i m. Monad m ⇒ DSL (addValue ∷ I|i) m 304 | missingValue = set' "" undefinedValue 305 | 306 | missingName ∷ ∀ i m. Monad m ⇒ DSL (addName ∷ I|i) m 307 | missingName = set' "" undefinedValue 308 | 309 | valuePair ∷ ∀ i m. Monad m ⇒ String → Number → DSL (value ∷ I|i) m 310 | valuePair a b = set' "value" $ toForeign [toForeign a, toForeign b] 311 | 312 | titles ∷ ∀ i m. Monad m ⇒ CommandsT TP.TitlesI m ~> CommandsT (title ∷ I|i) m 313 | titles = set "title" <=< buildArr 314 | 315 | title ∷ ∀ i m. Monad m ⇒ CommandsT TP.TitleI m ~> CommandsT (title ∷ I|i) m 316 | title = set "title" <=< buildObj 317 | 318 | text ∷ ∀ i m. Monad m ⇒ String → DSL (text ∷ I|i) m 319 | text a = set' "text" $ toForeign a 320 | 321 | showDelay ∷ ∀ i m. Monad m ⇒ Number → DSL (showDelay ∷ I|i) m 322 | showDelay a = set' "showDelay" $ toForeign a 323 | 324 | hideDelay ∷ ∀ i m. Monad m ⇒ Number → DSL (hideDelay ∷ I|i) m 325 | hideDelay a = set' "hideDelay" $ toForeign a 326 | 327 | pointerType ∷ ∀ i m. Monad m ⇒ T.PointerType → DSL (pointerType ∷ I|i) m 328 | pointerType a = set' "type" $ T.pointerTypeToForeign a 329 | 330 | zlevel ∷ ∀ i m. Monad m ⇒ Int → DSL (zlevel ∷ I|i) m 331 | zlevel a = set' "zlevel" $ toForeign a 332 | 333 | lineType ∷ ∀ i m. Monad m ⇒ T.LineType → DSL (lineType ∷ I|i) m 334 | lineType a = set' "type" $ toForeign a 335 | 336 | width ∷ ∀ i m. Monad m ⇒ Int → DSL (width ∷ I|i) m 337 | width a = set' "width" $ toForeign a 338 | 339 | widthPct ∷ ∀ i m. Monad m ⇒ Number → DSL (width ∷ I|i) m 340 | widthPct = set' "width" <<< toForeign <<< (_ <> "%") <<< show 341 | 342 | axisPointer ∷ ∀ i m. Monad m ⇒ CommandsT TP.AxisPointerI m ~> CommandsT (axisPointer ∷ I|i) m 343 | axisPointer = set "axisPointer" <=< buildObj 344 | 345 | scale ∷ ∀ i m. Monad m ⇒ Boolean → DSL (scale ∷ I|i) m 346 | scale a = set' "scale" $ toForeign a 347 | 348 | large ∷ ∀ i m. Monad m ⇒ Boolean → DSL (large ∷ I|i) m 349 | large a = set' "large" $ toForeign a 350 | 351 | formatterAxis ∷ ∀ i m. Monad m ⇒ (Array T.FormatterInput → String) → DSL (formatter ∷ I|i) m 352 | formatterAxis a = set' "formatter" $ toForeign a 353 | 354 | formatterAxisArrayValue 355 | ∷ ∀ i m. Monad m ⇒ (Array T.FormatterInputArrayValue → String) → DSL (formatter ∷ I|i) m 356 | formatterAxisArrayValue a = set' "formatter" $ toForeign a 357 | 358 | formatterItem 359 | ∷ ∀ i m. Monad m ⇒ (T.FormatterInput → String) → DSL (formatter ∷ I|i) m 360 | formatterItem a = set' "formatter" $ toForeign a 361 | 362 | formatterItemArrayValue 363 | ∷ ∀ i m. Monad m ⇒ (T.FormatterInputArrayValue → String) → DSL (formatter ∷ I|i) m 364 | formatterItemArrayValue a = set' "formatter" $ toForeign a 365 | 366 | formatterString ∷ ∀ i m. Monad m ⇒ String → DSL (formatter ∷ I|i) m 367 | formatterString a = set' "formatter" $ toForeign a 368 | 369 | formatterValue ∷ ∀ i m. Monad m ⇒ (Number → String) → DSL (formatter ∷ I|i) m 370 | formatterValue = set' "formatter" <<< toForeign 371 | 372 | formatterLabel ∷ ∀ i m. Monad m ⇒ (String → String) → DSL (formatter ∷ I|i) m 373 | formatterLabel = set' "formatter" <<< toForeign 374 | 375 | animationEnabled ∷ ∀ i m. Monad m ⇒ Boolean → DSL (animation ∷ I|i) m 376 | animationEnabled a = set' "animation" $ toForeign a 377 | 378 | splitLine ∷ ∀ i m. Monad m ⇒ CommandsT TP.SplitLineI m ~> CommandsT (splitLine ∷ I|i) m 379 | splitLine = set "splitLine" <=< buildObj 380 | 381 | boundaryGap ∷ ∀ i m. Monad m ⇒ T.Point → DSL (boundaryGap ∷ I|i) m 382 | boundaryGap a = set' "boundaryGap" $ T.pointToForeign a 383 | 384 | disabledBoundaryGap ∷ ∀ i m. Monad m ⇒ DSL (boundaryGap ∷ I|i) m 385 | disabledBoundaryGap = set' "boundaryGap" $ toForeign false 386 | 387 | enabledBoundaryGap ∷ ∀ i m. Monad m ⇒ DSL (boundaryGap ∷ I|i) m 388 | enabledBoundaryGap = set' "boundaryGap" $ toForeign true 389 | 390 | hoverAnimationEnabled ∷ ∀ i m. Monad m ⇒ Boolean → DSL (hoverAnimation ∷ I|i) m 391 | hoverAnimationEnabled a = set' "hoverAnimation" $ toForeign a 392 | 393 | showSymbol ∷ ∀ i m. Monad m ⇒ Boolean → DSL (showSymbol ∷ I|i) m 394 | showSymbol a = set' "showSymbol" $ toForeign a 395 | 396 | selectedMode ∷ ∀ i m. Monad m ⇒ T.SelectedMode → DSL (selectedMode ∷ I|i) m 397 | selectedMode a = set' "selectedMode" $ T.selectedModeToForeign a 398 | 399 | label ∷ ∀ i m. Monad m ⇒ CommandsT TP.LabelI m ~> CommandsT (label ∷ I|i) m 400 | label = set "label" <=< buildObj 401 | 402 | normalLabel ∷ ∀ i m. Monad m ⇒ CommandsT TP.LabelInnerI m ~> CommandsT (normal ∷ R TP.LabelInnerI|i) m 403 | normalLabel = normal 404 | 405 | precision ∷ ∀ i m. Monad m ⇒ Number → DSL (precision ∷ I|i) m 406 | precision = set' "precision" <<< toForeign 407 | 408 | emphasisLabel ∷ ∀ i m. Monad m ⇒ CommandsT TP.LabelInnerI m ~> CommandsT (emphasis ∷ R TP.LabelInnerI|i) m 409 | emphasisLabel = emphasis 410 | 411 | selected ∷ ∀ i m. Monad m ⇒ Boolean → DSL (selected ∷ I|i) m 412 | selected a = set' "selected" $ toForeign a 413 | 414 | leftPosition ∷ ∀ i m. Monad m ⇒ T.HorizontalPosition → DSL (left ∷ I|i) m 415 | leftPosition a = set' "left" $ T.horizontalPositionToForeign a 416 | 417 | alignLeft ∷ ∀ i m. Monad m ⇒ DSL (align ∷ I|i) m 418 | alignLeft = set' "align" $ toForeign "left" 419 | 420 | alignRight ∷ ∀ i m. Monad m ⇒ DSL (align ∷ I|i) m 421 | alignRight = set' "align" $ toForeign "right" 422 | 423 | alignAuto ∷ ∀ i m. Monad m ⇒ DSL (align ∷ I|i) m 424 | alignAuto = set' "align" $ toForeign "auto" 425 | 426 | funnelLeft ∷ ∀ i m. Monad m ⇒ DSL (funnelAlign ∷ I|i) m 427 | funnelLeft = set' "funnelAlign" $ toForeign "left" 428 | 429 | funnelRight ∷ ∀ i m. Monad m ⇒ DSL (funnelAlign ∷ I|i) m 430 | funnelRight = set' "funnelAlign" $ toForeign "right" 431 | 432 | funnelCenter ∷ ∀ i m. Monad m ⇒ DSL (funnelAlign ∷ I|i) m 433 | funnelCenter = set' "funnelAlign" $ toForeign "center" 434 | 435 | textLeft ∷ ∀ i m. Monad m ⇒ DSL (textAlign ∷ I|i) m 436 | textLeft = set' "textAlign" $ toForeign "left" 437 | 438 | textRight ∷ ∀ i m. Monad m ⇒ DSL (textAlign ∷ I|i) m 439 | textRight = set' "textAlign" $ toForeign "right" 440 | 441 | textCenter ∷ ∀ i m. Monad m ⇒ DSL (textAlign ∷ I|i) m 442 | textCenter = set' "textAlign" $ toForeign "center" 443 | 444 | textTop ∷ ∀ i m. Monad m ⇒ DSL (textBaseline ∷ I|i) m 445 | textTop = set' "textBaseline" $ toForeign "top" 446 | 447 | textBottom ∷ ∀ i m. Monad m ⇒ DSL (textBaseline ∷ I|i) m 448 | textBottom = set' "textBaseline" $ toForeign "bottom" 449 | 450 | textMiddle ∷ ∀ i m. Monad m ⇒ DSL (textBaseline ∷ I|i) m 451 | textMiddle = set' "textBaseline" $ toForeign "middle" 452 | 453 | brush ∷ ∀ i m. Monad m ⇒ CommandsT TP.BrushI m ~> CommandsT (brush ∷ I|i) m 454 | brush = set "brush" <=< buildObj 455 | 456 | brushType ∷ ∀ i m. Monad m ⇒ CommandsT TP.BrushToolboxI m ~> CommandsT (brushType ∷ I|i) m 457 | brushType = set "type" <=< buildArr 458 | 459 | brushToolbox ∷ ∀ i m. Monad m ⇒ CommandsT TP.BrushToolboxI m ~> CommandsT (brushToolbox ∷ I|i) m 460 | brushToolbox = set "toolbox" <=< buildArr 461 | 462 | brushModeSingle ∷ ∀ i m. Monad m ⇒ DSL (brushMode ∷ I|i) m 463 | brushModeSingle = set' "brushMode" $ toForeign "single" 464 | 465 | brushIcons ∷ ∀ i m. Monad m ⇒ CommandsT TP.BFFieldI m ~> CommandsT (bfIcon ∷ I|i) m 466 | brushIcons a = set "icon" =<< buildObj a 467 | 468 | brushTitle ∷ ∀ i m. Monad m ⇒ CommandsT TP.BFFieldI m ~> CommandsT (bfTitle ∷ I|i) m 469 | brushTitle a = set "title" =<< buildObj a 470 | 471 | brushModeMultiple ∷ ∀ i m. Monad m ⇒ DSL (brushMode ∷ I|i) m 472 | brushModeMultiple = set' "brushMode" $ toForeign "multiple" 473 | 474 | rect ∷ ∀ i m. Monad m ⇒ DSL (tool ∷ I|i) m 475 | rect = set' "" $ toForeign "rect" 476 | 477 | setRect ∷ ∀ i m. Monad m ⇒ String → DSL (rect ∷ I|i) m 478 | setRect a = set' "rect" $ toForeign a 479 | 480 | polygon ∷ ∀ i m. Monad m ⇒ DSL (tool ∷ I|i) m 481 | polygon = set' "" $ toForeign "polygon" 482 | 483 | setPolygon ∷ ∀ i m. Monad m ⇒ String → DSL (polygon ∷ I|i) m 484 | setPolygon a = set' "polygon" $ toForeign a 485 | 486 | lineX ∷ ∀ i m. Monad m ⇒ DSL (tool ∷ I|i) m 487 | lineX = set' "" $ toForeign "lineX" 488 | 489 | setLineX ∷ ∀ i m. Monad m ⇒ String → DSL (lineX ∷ I|i) m 490 | setLineX a = set' "lineX" $ toForeign a 491 | 492 | lineY ∷ ∀ i m. Monad m ⇒ DSL (tool ∷ I|i) m 493 | lineY = set' "" $ toForeign "lineY" 494 | 495 | setLineY ∷ ∀ i m. Monad m ⇒ String → DSL (lineY ∷ I|i) m 496 | setLineY a = set' "lineY" $ toForeign a 497 | 498 | keep ∷ ∀ i m. Monad m ⇒ DSL (tool ∷ I|i) m 499 | keep = set' "" $ toForeign "keep" 500 | 501 | setKeep ∷ ∀ i m. Monad m ⇒ String → DSL (keep ∷ I|i) m 502 | setKeep a = set' "keep" $ toForeign a 503 | 504 | clear ∷ ∀ i m. Monad m ⇒ DSL (tool ∷ I|i) m 505 | clear = set' "" $ toForeign "clear" 506 | 507 | setClear ∷ ∀ i m. Monad m ⇒ String → DSL (clear ∷ I|i) m 508 | setClear a = set' "clear" $ toForeign a 509 | 510 | dataZoom ∷ ∀ i m. Monad m ⇒ CommandsT TP.DataZoomI m ~> CommandsT (dataZoom ∷ I|i) m 511 | dataZoom = set "dataZoom" <=< buildSeries 512 | 513 | insideDataZoom ∷ ∀ i m. Monad m ⇒ CommandsT TP.InsideDataZoomI m ~> CommandsT (insideDataZoom ∷ I|i) m 514 | insideDataZoom = set "inside" <=< buildObj 515 | 516 | sliderDataZoom ∷ ∀ i m. Monad m ⇒ CommandsT TP.SliderDataZoomI m ~> CommandsT (sliderDataZoom ∷ I|i) m 517 | sliderDataZoom = set "slider" <=< buildObj 518 | 519 | toolbox ∷ ∀ i m. Monad m ⇒ CommandsT TP.ToolboxI m ~> CommandsT (toolbox ∷ I|i) m 520 | toolbox a = set "toolbox" =<< buildObj a 521 | 522 | feature ∷ ∀ i m. Monad m ⇒ CommandsT TP.FeatureI m ~> CommandsT (feature ∷ I|i) m 523 | feature a = set "feature" =<< buildObj a 524 | 525 | brushFeature ∷ ∀ i m. Monad m ⇒ CommandsT TP.BrushFeatureI m ~> CommandsT (brush ∷ I|i) m 526 | brushFeature a = set "brush" =<< buildObj a 527 | 528 | magicType ∷ ∀ i m. Monad m ⇒ CommandsT TP.MagicTypeI m ~> CommandsT (magicType ∷ I|i) m 529 | magicType a = set "magicType" =<< buildObj a 530 | 531 | magics ∷ ∀ i m. Monad m ⇒ CommandsT TP.MagicsI m ~> CommandsT (magics ∷ I|i) m 532 | magics a = set "type" =<< buildArr a 533 | 534 | magicLine ∷ ∀ i m. Monad m ⇒ DSL (magic ∷ I|i) m 535 | magicLine = set' "" $ toForeign "line" 536 | 537 | magicBar ∷ ∀ i m. Monad m ⇒ DSL (magic ∷ I|i) m 538 | magicBar = set' "" $ toForeign "bar" 539 | 540 | magicStack ∷ ∀ i m. Monad m ⇒ DSL (magic ∷ I|i) m 541 | magicStack = set' "" $ toForeign "stack" 542 | 543 | magicTiled ∷ ∀ i m. Monad m ⇒ DSL (magic ∷ I|i) m 544 | magicTiled = set' "" $ toForeign "tiled" 545 | 546 | dataView ∷ ∀ i m. Monad m ⇒ CommandsT TP.DataViewI m ~> CommandsT (dataView ∷ I|i) m 547 | dataView a = set "dataView" =<< buildObj a 548 | 549 | dataZoomFeature ∷ ∀ i m. Monad m ⇒ CommandsT TP.DataZoomFeatureI m ~> CommandsT (dataZoom ∷ I|i) m 550 | dataZoomFeature = set "dataZoom" <=< buildObj 551 | 552 | splitArea ∷ ∀ i m. Monad m ⇒ CommandsT TP.SplitAreaI m ~> CommandsT (splitArea ∷ I|i) m 553 | splitArea a = set "splitArea" =<< buildObj a 554 | 555 | axisLine ∷ ∀ i m. Monad m ⇒ CommandsT TP.AxisLineI m ~> CommandsT (axisLine ∷ I|i) m 556 | axisLine a = set "axisLine" =<< buildObj a 557 | 558 | silent ∷ ∀ i m. Monad m ⇒ Boolean → DSL (silent ∷ I|i) m 559 | silent a = set' "silent" $ toForeign a 560 | 561 | onZero ∷ ∀ i m. Monad m ⇒ Boolean → DSL (onZero ∷ I|i) m 562 | onZero a = set' "onZero" $ toForeign a 563 | 564 | inverse ∷ ∀ i m. Monad m ⇒ Boolean → DSL (inverse ∷ I|i) m 565 | inverse a = set' "inverse" $ toForeign a 566 | 567 | visualMap ∷ ∀ i m. Monad m ⇒ CommandsT TP.VisualMapI m ~> CommandsT (visualMap ∷ I|i) m 568 | visualMap a = set "visualMap" =<< buildSeries a 569 | 570 | calendar ∷ ∀ i m. Monad m ⇒ CommandsT TP.CalendarI m ~> CommandsT (calendar ∷ I|i) m 571 | calendar a = set "calendar" =<< buildSeries a 572 | 573 | continuous ∷ ∀ i m. Monad m ⇒ CommandsT TP.ContinuousVisualMapI m ~> CommandsT (continuousVisualMap ∷ I|i) m 574 | continuous a = set "continuous" =<< buildObj a 575 | 576 | dimension ∷ ∀ i m. Monad m ⇒ Int → DSL (dimension ∷ I|i) m 577 | dimension a = set' "dimension" $ toForeign a 578 | 579 | textPair ∷ ∀ i m. Monad m ⇒ String → String → DSL (textPair ∷ I|i) m 580 | textPair high low = set' "text" $ toForeign [high, low] 581 | 582 | itemHeight ∷ ∀ i m. Monad m ⇒ Number → DSL (itemHeight ∷ I|i) m 583 | itemHeight a = set' "itemHeight" $ toForeign a 584 | 585 | itemWidth ∷ ∀ i m. Monad m ⇒ Number → DSL (itemWidth ∷ I|i) m 586 | itemWidth a = set' "itemWidth" $ toForeign a 587 | 588 | calculable ∷ ∀ i m. Monad m ⇒ Boolean → DSL (calculable ∷ I|i) m 589 | calculable a = set' "calculable" $ toForeign a 590 | 591 | min ∷ ∀ i m. Monad m ⇒ Number → DSL (min ∷ I|i) m 592 | min a = set' "min" $ toForeign a 593 | 594 | max ∷ ∀ i m. Monad m ⇒ Number → DSL (max ∷ I|i) m 595 | max a = set' "max" $ toForeign a 596 | 597 | inRange ∷ ∀ i m. Monad m ⇒ CommandsT TP.InOutRangeI m ~> CommandsT (inRange ∷ I|i) m 598 | inRange a = set "inRange" =<< buildObj a 599 | 600 | outOfRange ∷ ∀ i m. Monad m ⇒ CommandsT TP.InOutRangeI m ~> CommandsT (outOfRange ∷ I|i) m 601 | outOfRange a = set "outOfRange" =<< buildObj a 602 | 603 | controller ∷ ∀ i m. Monad m ⇒ CommandsT TP.ControllerI m ~> CommandsT (controller ∷ I|i) m 604 | controller a = set "controller" =<< buildObj a 605 | 606 | colorLightness ∷ ∀ i m. Monad m ⇒ Number → Number → DSL (colorLightness ∷ I|i) m 607 | colorLightness a b = set' "colorLightness" $ toForeign [a, b] 608 | 609 | itemStyle ∷ ∀ i m. Monad m ⇒ CommandsT TP.ItemStyleI m ~> CommandsT (itemStyle ∷ I|i) m 610 | itemStyle a = set "itemStyle" =<< buildObj a 611 | 612 | normalItemStyle ∷ ∀ i m. Monad m ⇒ CommandsT TP.IStyleI m ~> CommandsT (normal ∷ R TP.IStyleI|i) m 613 | normalItemStyle = normal 614 | 615 | emphasisItemStyle ∷ ∀ i m. Monad m ⇒ CommandsT TP.IStyleI m ~> CommandsT (emphasis ∷ R TP.IStyleI|i) m 616 | emphasisItemStyle = emphasis 617 | 618 | barBorderWidth ∷ ∀ i m. Monad m ⇒ Number → DSL (barBorderWidth ∷ I|i) m 619 | barBorderWidth a = set' "barBorderWidth" $ toForeign a 620 | 621 | shadowBlur ∷ ∀ i m. Monad m ⇒ Number → DSL (shadowBlur ∷ I|i) m 622 | shadowBlur a = set' "shadowBlur" $ toForeign a 623 | 624 | shadowOffsetX ∷ ∀ i m. Monad m ⇒ Number → DSL (shadowOffsetX ∷ I|i) m 625 | shadowOffsetX a = set' "shadowOffsetX" $ toForeign a 626 | 627 | shadowOffsetY ∷ ∀ i m. Monad m ⇒ Number → DSL (shadowOffsetY ∷ I|i) m 628 | shadowOffsetY a = set' "shadowOffsetY" $ toForeign a 629 | 630 | shadowColor ∷ ∀ i m. Monad m ⇒ C.Color → DSL (shadowColor ∷ I|i) m 631 | shadowColor a = set' "shadowColor" $ toForeign $ C.cssStringRGBA a 632 | 633 | restore ∷ ∀ i m. Monad m ⇒ CommandsT TP.RestoreI m ~> CommandsT (restore ∷ I|i) m 634 | restore = set "restore" <=< buildObj 635 | 636 | saveAsImage ∷ ∀ i m. Monad m ⇒ CommandsT TP.SaveAsImageI m ~> CommandsT (saveAsImage ∷ I|i) m 637 | saveAsImage = set "saveAsImage" <=< buildObj 638 | 639 | z ∷ ∀ i m. Monad m ⇒ Int → DSL (z ∷ I|i) m 640 | z = set' "z" <<< toForeign 641 | 642 | splitNumber ∷ ∀ i m. Monad m ⇒ Int → DSL (splitNumber ∷ I|i) m 643 | splitNumber = set' "splitNumber" <<< toForeign 644 | 645 | gaugeRadius ∷ ∀ i m. Monad m ⇒ T.PixelOrPercent → DSL (gaugeRadius ∷ I|i) m 646 | gaugeRadius = set' "radius" <<< T.pixelOrPercentToForeign 647 | 648 | detail ∷ ∀ i m. Monad m ⇒ CommandsT TP.DetailI m ~> CommandsT (detail ∷ I|i) m 649 | detail = set "detail" <=< buildObj 650 | 651 | endAngle ∷ ∀ i m. Monad m ⇒ Number → DSL (endAngle ∷ I|i) m 652 | endAngle = set' "endAngle" <<< toForeign 653 | 654 | gaugePointer ∷ ∀ i m. Monad m ⇒ CommandsT TP.GaugePointerI m ~> CommandsT (gaugePointer ∷ I|i) m 655 | gaugePointer = set "pointer" <=< buildObj 656 | 657 | length ∷ ∀ i m. Monad m ⇒ Int → DSL (length ∷ I|i) m 658 | length = set' "length" <<< toForeign 659 | 660 | autoColor ∷ ∀ i m. Monad m ⇒ DSL (color ∷ I|i) m 661 | autoColor = set' "color" $ toForeign "auto" 662 | 663 | bolderFontWeight ∷ ∀ i m. Monad m ⇒ DSL (fontWeight ∷ I|i) m 664 | bolderFontWeight = set' "fontWeight" $ toForeign "bolder" 665 | 666 | fontSize ∷ ∀ i m. Monad m ⇒ Int → DSL (fontSize ∷ I|i) m 667 | fontSize = set' "fontSize" <<< toForeign 668 | 669 | italicFontStyle ∷ ∀ i m. Monad m ⇒ DSL (fontStyle ∷ I|i) m 670 | italicFontStyle = set' "fontStyle" $ toForeign "italic" 671 | 672 | offsetCenter ∷ ∀ i m. Monad m ⇒ T.Point → DSL (offsetCenter ∷ I|i) m 673 | offsetCenter = set' "offsetCenter" <<< T.pointToForeign 674 | 675 | subtext ∷ ∀ i m. Monad m ⇒ String → DSL (subtext ∷ I|i) m 676 | subtext = set' "subtext" <<< toForeign 677 | 678 | readOnly ∷ ∀ i m. Monad m ⇒ Boolean → DSL (readOnly ∷ I|i) m 679 | readOnly = set' "readOnly" <<< toForeign 680 | 681 | positionInside ∷ ∀ i m. Monad m ⇒ DSL (position ∷ I|i) m 682 | positionInside = set' "position" $ toForeign "inside" 683 | 684 | positionTop ∷ ∀ i m. Monad m ⇒ DSL (position ∷ I|i) m 685 | positionTop = set' "position" $ toForeign "top" 686 | 687 | labelLine ∷ ∀ i m. Monad m ⇒ CommandsT TP.LabelLineI m ~> CommandsT (labelLine ∷ I|i) m 688 | labelLine = set "labelLine" <=< buildObj 689 | 690 | normalLabelLine ∷ ∀ i m. Monad m ⇒ CommandsT TP.LabelLineInnerI m ~> CommandsT (normal ∷ R TP.LabelLineInnerI|i) m 691 | normalLabelLine = normal 692 | 693 | emphasisLabelLine 694 | ∷ ∀ i m. Monad m ⇒ CommandsT TP.LabelLineInnerI m ~> CommandsT (emphasis ∷ R TP.LabelLineInnerI|i) m 695 | emphasisLabelLine = emphasis 696 | 697 | opacity ∷ ∀ i m. Monad m ⇒ Number → DSL (opacity ∷ I|i) m 698 | opacity = set' "opacity" <<< toForeign 699 | 700 | maxSize ∷ ∀ i m. Monad m ⇒ Int → DSL (maxSize ∷ I|i) m 701 | maxSize = set' "maxSize" <<< toForeign 702 | 703 | maxSizePct ∷ ∀ i m. Monad m ⇒ Number → DSL (maxSize ∷ I|i) m 704 | maxSizePct = set' "maxSize" <<< toForeign <<< (_ <> "%") <<< show 705 | 706 | borderColor ∷ ∀ i m. Monad m ⇒ C.Color → DSL (borderColor ∷ I|i) m 707 | borderColor = set' "borderColor" <<< toForeign <<< C.toHexString 708 | 709 | borderWidth ∷ ∀ i m. Monad m ⇒ Int → DSL (borderWidth ∷ I|i) m 710 | borderWidth = set' "borderWidth" <<< toForeign 711 | 712 | normalLineStyle ∷ ∀ i m. Monad m ⇒ CommandsT TP.LineStyleI m ~> CommandsT (normal ∷ R TP.LineStyleI|i) m 713 | normalLineStyle = normal 714 | 715 | emphasisLineStyle ∷ ∀ i m. Monad m ⇒ CommandsT TP.LineStyleI m ~> CommandsT (emphasis ∷ R TP.LineStyleI|i) m 716 | emphasisLineStyle = emphasis 717 | 718 | leftCenter ∷ ∀ i m. Monad m ⇒ DSL (left ∷ I|i) m 719 | leftCenter = set' "left" $ toForeign "center" 720 | 721 | leftLeft ∷ ∀ i m. Monad m ⇒ DSL (left ∷ I|i) m 722 | leftLeft = set' "left" $ toForeign "left" 723 | 724 | leftRight ∷ ∀ i m. Monad m ⇒ DSL (left ∷ I|i) m 725 | leftRight = set' "left" $ toForeign "right" 726 | 727 | itemGap ∷ ∀ i m. Monad m ⇒ Int → DSL (itemGap ∷ I|i) m 728 | itemGap = set' "itemGap" <<< toForeign 729 | 730 | indicators ∷ ∀ i m. Monad m ⇒ CommandsT TP.IndicatorsI m ~> CommandsT (indicators ∷ I|i) m 731 | indicators = set "indicator" <=< buildArr 732 | 733 | indicator ∷ ∀ i m. Monad m ⇒ CommandsT TP.IndicatorI m ~> CommandsT (indicator ∷ I|i) m 734 | indicator = set "" <=< buildObj 735 | 736 | radarName ∷ ∀ i m. Monad m ⇒ CommandsT TP.RadarNameI m ~> CommandsT (radarName ∷ I|i) m 737 | radarName = set "name" <=< buildObj 738 | 739 | nameGap ∷ ∀ i m. Monad m ⇒ Number → DSL (nameGap ∷ I|i) m 740 | nameGap = set' "nameGap" <<< toForeign 741 | 742 | polygonShape ∷ ∀ i m. Monad m ⇒ DSL (shape ∷ I|i) m 743 | polygonShape = set' "shape" $ toForeign "polygon" 744 | 745 | circleShape ∷ ∀ i m. Monad m ⇒ DSL (shape ∷ I|i) m 746 | circleShape = set' "shape" $ toForeign "circle" 747 | 748 | lineStylePair ∷ ∀ i m. Monad m ⇒ CommandsT TP.LineStylePairI m ~> CommandsT (lineStyle ∷ R TP.LineStylePairI|i) m 749 | lineStylePair = lineStyle 750 | 751 | areaStylePair ∷ ∀ i m. Monad m ⇒ CommandsT TP.AreaStylePairI m ~> CommandsT (areaStyle ∷ R TP.AreaStylePairI|i) m 752 | areaStylePair = areaStyle 753 | 754 | normalAreaStyle ∷ ∀ i m. Monad m ⇒ CommandsT TP.AreaStyleI m ~> CommandsT (normal ∷ R TP.AreaStyleI|i) m 755 | normalAreaStyle = normal 756 | 757 | emphasisAreaStyle ∷ ∀ i m. Monad m ⇒ CommandsT TP.AreaStyleI m ~> CommandsT (emphasis ∷ R TP.AreaStyleI|i) m 758 | emphasisAreaStyle = emphasis 759 | 760 | radars ∷ ∀ i m. Monad m ⇒ CommandsT TP.RadarsI m ~> CommandsT (radar ∷ I|i) m 761 | radars = set "radar" <=< buildArr 762 | 763 | radar ∷ ∀ i m. Monad m ⇒ CommandsT TP.RadarI m ~> CommandsT (radar ∷ I|i) m 764 | radar = set "radar" <=< buildObj 765 | 766 | ascending ∷ ∀ i m. Monad m ⇒ DSL (sort ∷ I|i) m 767 | ascending = set' "sort" $ toForeign "ascending" 768 | 769 | descending ∷ ∀ i m. Monad m ⇒ DSL (sort ∷ I|i) m 770 | descending = set' "sort" $ toForeign "descending" 771 | 772 | animationDurationUpdate ∷ ∀ i m. Monad m ⇒ Int → DSL (animationDurationUpdate ∷ I|i) m 773 | animationDurationUpdate = set' "animationDurationUpdate" <<< toForeign 774 | 775 | animationEasingUpdateQuinticInOut ∷ ∀ i m. Monad m ⇒ DSL (animationEasingUpdate ∷ I|i) m 776 | animationEasingUpdateQuinticInOut = set' "animationEasingUpdate" $ toForeign "quinticInOut" 777 | 778 | roam ∷ ∀ i m. Monad m ⇒ Boolean → DSL (roam ∷ I|i) m 779 | roam = set' "roam" <<< toForeign 780 | 781 | edgeSymbols ∷ ∀ i m. Monad m ⇒ CommandsT TP.EdgeSymbolsI m ~> CommandsT (edgeSymbols ∷ I|i) m 782 | edgeSymbols = set "edgeSymbol" <=< buildArr 783 | 784 | circleEdgeSymbol ∷ ∀ i m. Monad m ⇒ DSL (edgeSymbol ∷ I|i) m 785 | circleEdgeSymbol = set' "" $ toForeign "circle" 786 | 787 | arrowEdgeSymbol ∷ ∀ i m. Monad m ⇒ DSL (edgeSymbol ∷ I|i) m 788 | arrowEdgeSymbol = set' "" $ toForeign "arrow" 789 | 790 | edgeSymbolSize ∷ ∀ i m. Monad m ⇒ Int → DSL (edgeSymbolSize ∷ I|i) m 791 | edgeSymbolSize = set' "edgeSymbolSize" <<< toForeign 792 | 793 | edgeSymbolSizes ∷ ∀ i m. Monad m ⇒ Int → Int → DSL (edgeSymbolSize ∷ I|i) m 794 | edgeSymbolSizes a b = set' "edgeSymbolSize" $ toForeign [a, b] 795 | 796 | buildLinks ∷ ∀ i m. Monad m ⇒ CommandsT TP.LinksI m ~> CommandsT (links ∷ I|i) m 797 | buildLinks = set "links" <=< buildArr 798 | 799 | addLink ∷ ∀ i m. Monad m ⇒ CommandsT TP.LinkI m ~> CommandsT (link ∷ I|i) m 800 | addLink = set "" <=< buildObj 801 | 802 | links ∷ ∀ i m. Monad m ⇒ Array { source ∷ String, target ∷ String } → DSL (links ∷ I|i) m 803 | links = set' "links" <<< toForeign 804 | 805 | edgeLabel ∷ ∀ i m. Monad m ⇒ CommandsT TP.EdgeLabelI m ~> CommandsT (edgeLabel ∷ I|i) m 806 | edgeLabel = set "edgeLabel" <=< buildObj 807 | 808 | normalEdgeLabel 809 | ∷ ∀ i m 810 | . Monad m 811 | ⇒ CommandsT TP.EdgeLabelInnerI m 812 | ~> CommandsT (normal ∷ R TP.EdgeLabelInnerI|i) m 813 | normalEdgeLabel = normal 814 | 815 | emphasisEdgeLabel 816 | ∷ ∀ i m 817 | . Monad m 818 | ⇒ CommandsT TP.EdgeLabelInnerI m 819 | ~> CommandsT (emphasis ∷ R TP.EdgeLabelInnerI|i) m 820 | emphasisEdgeLabel = emphasis 821 | 822 | x ∷ ∀ i m. Monad m ⇒ Number → DSL (x ∷ I|i) m 823 | x = set' "x" <<< toForeign 824 | 825 | y ∷ ∀ i m. Monad m ⇒ Number → DSL (y ∷ I|i) m 826 | y = set' "y" <<< toForeign 827 | 828 | curveness ∷ ∀ i m. Monad m ⇒ Number → DSL (curveness ∷ I|i) m 829 | curveness = set' "curveness" <<< toForeign 830 | 831 | symbolSizes ∷ ∀ i m. Monad m ⇒ Int → Int → DSL (symbolSize ∷ I|i) m 832 | symbolSizes a b = set' "symbolSize" $ toForeign [a, b] 833 | 834 | symbolSizeArrFunc ∷ ∀ i m. Monad m ⇒ (Array Number → Number) → DSL (symbolSize ∷ I|i) m 835 | symbolSizeArrFunc fn = set' "symbolSize" $ toForeign fn 836 | 837 | sourceIx ∷ ∀ i m. Monad m ⇒ Int → DSL (source ∷ I|i) m 838 | sourceIx = set' "source" <<< toForeign 839 | 840 | targetIx ∷ ∀ i m. Monad m ⇒ Int → DSL (target ∷ I|i) m 841 | targetIx = set' "target" <<< toForeign 842 | 843 | sourceName ∷ ∀ i m. Monad m ⇒ String → DSL (source ∷ I|i) m 844 | sourceName = set' "source" <<< toForeign 845 | 846 | targetName ∷ ∀ i m. Monad m ⇒ String → DSL (target ∷ I|i) m 847 | targetName = set' "target" <<< toForeign 848 | 849 | subtargetName ∷ ∀ i m. Monad m ⇒ String → DSL (subtarget ∷ I|i) m 850 | subtargetName = set' "subtarget" <<< toForeign 851 | 852 | layoutNone ∷ ∀ i m. Monad m ⇒ DSL (layout ∷ I|i) m 853 | layoutNone = set' "layout" $ toForeign "none" 854 | 855 | layoutCircular ∷ ∀ i m. Monad m ⇒ DSL (layout ∷ I|i) m 856 | layoutCircular = set' "layout" $ toForeign "circular" 857 | 858 | layoutForce ∷ ∀ i m. Monad m ⇒ DSL (layout ∷ I|i) m 859 | layoutForce = set' "layout" $ toForeign "force" 860 | 861 | missingSeries ∷ ∀ i m. Monad m ⇒ DSL (missing ∷ I|i) m 862 | missingSeries = set' "" undefinedValue 863 | 864 | missingItem ∷ ∀ i m. Monad m ⇒ DSL (item ∷ I|i) m 865 | missingItem = set' "" undefinedValue 866 | 867 | rotate ∷ ∀ i m. Monad m ⇒ Number → DSL (rotate ∷ I|i) m 868 | rotate = set' "rotate" <<< toForeign 869 | 870 | fontFamily ∷ ∀ i m. Monad m ⇒ String → DSL (fontFamily ∷ I|i) m 871 | fontFamily = set' "fontFamily" <<< toForeign 872 | 873 | addParallelAxis ∷ ∀ i m. Monad m ⇒ CommandsT TP.ParallelAxisI m ~> CommandsT (addParallelAxis ∷ I|i) m 874 | addParallelAxis = set "" <=< buildObj 875 | 876 | parallelAxes ∷ ∀ i m. Monad m ⇒ CommandsT TP.ParallelAxesI m ~> CommandsT (parallelAxis ∷ I|i) m 877 | parallelAxes = set "parallelAxis" <=< buildArr 878 | 879 | parallelAxisDefault ∷ ∀ i m. Monad m ⇒ CommandsT TP.ParallelAxisI m ~> CommandsT (parallelAxisDefault ∷ I|i) m 880 | parallelAxisDefault = set "parallelAxisDefault" <=< buildObj 881 | 882 | yAxes ∷ ∀ i m. Monad m ⇒ CommandsT TP.YAxesI m ~> CommandsT (yAxis ∷ I|i) m 883 | yAxes = set "yAxis" <=< buildArr 884 | 885 | xAxes ∷ ∀ i m. Monad m ⇒ CommandsT TP.XAxesI m ~> CommandsT (xAxis ∷ I|i) m 886 | xAxes = set "xAxis" <=< buildArr 887 | 888 | addYAxis ∷ ∀ i m. Monad m ⇒ CommandsT TP.YAxisI m ~> CommandsT (addYAxis ∷ I|i) m 889 | addYAxis = set "" <=< buildObj 890 | 891 | addXAxis ∷ ∀ i m. Monad m ⇒ CommandsT TP.XAxisI m ~> CommandsT (addXAxis ∷ I|i) m 892 | addXAxis = set "" <=< buildObj 893 | 894 | interval ∷ ∀ i m. Monad m ⇒ Int → DSL (interval ∷ I|i) m 895 | interval = set' "interval" <<< toForeign 896 | 897 | lineAxisPointer ∷ ∀ i m. Monad m ⇒ DSL (axisPointerType ∷ I|i) m 898 | lineAxisPointer = set' "type" $ toForeign "line" 899 | 900 | crossAxisPointer ∷ ∀ i m. Monad m ⇒ DSL (axisPointerType ∷ I|i) m 901 | crossAxisPointer = set' "type" $ toForeign "cross" 902 | 903 | solidLine ∷ ∀ i m. Monad m ⇒ DSL (lineType ∷ I|i) m 904 | solidLine = set' "type" $ toForeign "solid" 905 | 906 | dashedLine ∷ ∀ i m. Monad m ⇒ DSL (lineType ∷ I|i) m 907 | dashedLine = set' "type" $ toForeign "dashed" 908 | 909 | dottedLine ∷ ∀ i m. Monad m ⇒ DSL (lineType ∷ I|i) m 910 | dottedLine = set' "type" $ toForeign "dotted" 911 | 912 | widthNum ∷ ∀ i m. Monad m ⇒ Number → DSL (width ∷ I|i) m 913 | widthNum = set' "width" <<< toForeign 914 | 915 | crossStyle ∷ ∀ i m. Monad m ⇒ CommandsT TP.CrossStyleI m ~> CommandsT (crossStyle ∷ I|i) m 916 | crossStyle = set "crossStyle" <=< buildObj 917 | 918 | normal ∷ ∀ p i m. Monad m ⇒ CommandsT p m ~> CommandsT (normal ∷ R p |i) m 919 | normal = set "normal" <=< buildObj 920 | 921 | lineStyle ∷ ∀ ρ i m. Monad m ⇒ CommandsT ρ m ~> CommandsT (lineStyle ∷ R ρ |i) m 922 | lineStyle = set "lineStyle" <=< buildObj 923 | 924 | areaStyle ∷ ∀ ρ i m. Monad m ⇒ CommandsT ρ m ~> CommandsT (areaStyle ∷ R ρ |i) m 925 | areaStyle = set "areaStyle" <=< buildObj 926 | 927 | emphasis ∷ ∀ ρ i m. Monad m ⇒ CommandsT ρ m ~> CommandsT (emphasis ∷ R ρ|i) m 928 | emphasis = set "emphasis" <=< buildObj 929 | 930 | heightPixelOrPercent ∷ ∀ i m. Monad m ⇒ T.PixelOrPercent → DSL (height ∷ I|i) m 931 | heightPixelOrPercent = set' "height" <<< T.pixelOrPercentToForeign 932 | 933 | heightPct ∷ ∀ i m. Monad m ⇒ Number → DSL (width ∷ I|i) m 934 | heightPct = set' "height" <<< toForeign <<< (_ <> "%") <<< show 935 | 936 | widthPixelOrPercent ∷ ∀ i m. Monad m ⇒ T.PixelOrPercent → DSL (width ∷ I|i) m 937 | widthPixelOrPercent = set' "width" <<< T.pixelOrPercentToForeign 938 | 939 | padding ∷ ∀ i m. Monad m ⇒ Number → DSL (padding ∷ I|i) m 940 | padding = set' "padding" <<< toForeign 941 | 942 | enterable ∷ ∀ i m. Monad m ⇒ Boolean → DSL (enterable ∷ I|i) m 943 | enterable = set' "enterable" <<< toForeign 944 | 945 | transitionDuration ∷ ∀ i m. Monad m ⇒ Number → DSL (transitionDuration ∷ I|i) m 946 | transitionDuration = set' "transitionDuration" <<< toForeign 947 | 948 | extraCssText ∷ ∀ i m. Monad m ⇒ String → DSL (extraCssText ∷ I|i) m 949 | extraCssText = set' "extraCssText" <<< toForeign 950 | 951 | gridIndex ∷ ∀ i m. Monad m ⇒ Int → DSL (gridIndex ∷ I|i) m 952 | gridIndex a = set' "gridIndex" $ toForeign a 953 | 954 | radarIndex ∷ ∀ i m. Monad m ⇒ Number → DSL (radarIndex ∷ I|i) m 955 | radarIndex = set' "radarIndex" <<< toForeign 956 | 957 | parallelIndex ∷ ∀ i m. Monad m ⇒ Int → DSL (parallelIndex ∷ I|i) m 958 | parallelIndex = set' "parallelIndex" <<< toForeign 959 | 960 | treeMapNodeId ∷ ∀ i m. Monad m ⇒ String → DSL (treeMapNodeId ∷ I|i) m 961 | treeMapNodeId = set' "id" <<< toForeign 962 | 963 | visualDimension ∷ ∀ i m. Monad m ⇒ Int → DSL (visualDimension ∷ I|i) m 964 | visualDimension = set' "visualDimension" <<< toForeign 965 | 966 | visibleMin ∷ ∀ i m. Monad m ⇒ Number → DSL (visibleMin ∷ I|i) m 967 | visibleMin = set' "visibleMin" <<< toForeign 968 | 969 | childVisibleMin ∷ ∀ i m. Monad m ⇒ Number → DSL (childVisibleMin ∷ I|i) m 970 | childVisibleMin = set' "childVisibleMin" <<< toForeign 971 | 972 | category ∷ ∀ i m. Monad m ⇒ Int → DSL (category ∷ I|i) m 973 | category = set' "category" <<< toForeign 974 | 975 | coords ∷ ∀ i f m. Monad m ⇒ F.Foldable f ⇒ f T.Coord → DSL (coords ∷ I|i) m 976 | coords a = set' "coords" $ toForeign $ F.foldMap (Arr.singleton <<< toForeign) a 977 | 978 | valueIndex ∷ ∀ i m. Monad m ⇒ Number → DSL (valueIndex ∷ I|i) m 979 | valueIndex = set' "valueIndex" <<< toForeign 980 | 981 | valueDim ∷ ∀ i m. Monad m ⇒ String → DSL (valueDim ∷ I|i) m 982 | valueDim = set' "valueDim" <<< toForeign 983 | 984 | markType ∷ ∀ i m. Monad m ⇒ String → DSL (markType ∷ I|i) m 985 | markType = set' "type" <<< toForeign 986 | 987 | margin ∷ ∀ i m. Monad m ⇒ Int → DSL (margin ∷ I|i) m 988 | margin = set' "margin" <<< toForeign 989 | 990 | markLine ∷ ∀ i m. Monad m ⇒ CommandsT TP.MarkLineI m ~> CommandsT (markLine ∷ I|i) m 991 | markLine = set "markLine" <=< buildObj 992 | 993 | markPoint ∷ ∀ i m. Monad m ⇒ CommandsT TP.MarkPointI m ~> CommandsT (markPoint ∷ I|i) m 994 | markPoint = set "markPoint" <=< buildObj 995 | 996 | markArea ∷ ∀ i m. Monad m ⇒ CommandsT TP.MarkAreaI m ~> CommandsT (markArea ∷ I|i) m 997 | markArea = set "markArea" <=< buildObj 998 | 999 | repulsion ∷ ∀ i m. Monad m ⇒ Number → DSL (repulsion ∷ I|i) m 1000 | repulsion = set' "repulsion" <<< toForeign 1001 | 1002 | gravity ∷ ∀ i m. Monad m ⇒ Number → DSL (gravity ∷ I|i) m 1003 | gravity = set' "gravity" <<< toForeign 1004 | 1005 | edgeLength ∷ ∀ i m. Monad m ⇒ Number → DSL (edgeLength ∷ I|i) m 1006 | edgeLength = set' "edgeLength" <<< toForeign 1007 | 1008 | edgeLengths ∷ ∀ i m. Monad m ⇒ Number → Number → DSL (edgeLength ∷ I|i) m 1009 | edgeLengths a b = set' "edgeLength" $ toForeign [ a, b ] 1010 | 1011 | layoutAnimation ∷ ∀ i m. Monad m ⇒ Boolean → DSL (layoutAnimation ∷ I|i) m 1012 | layoutAnimation = set' "layoutAnimation" <<< toForeign 1013 | 1014 | circular ∷ ∀ i m. Monad m ⇒ CommandsT TP.CircularI m ~> CommandsT (circular ∷ I|i) m 1015 | circular = set "circular" <=< buildObj 1016 | 1017 | rotateLabel ∷ ∀ i m. Monad m ⇒ Boolean → DSL (rotateLabel ∷ I|i) m 1018 | rotateLabel = set' "rotateLabel" <<< toForeign 1019 | 1020 | force ∷ ∀ i m. Monad m ⇒ CommandsT TP.ForceI m ~> CommandsT (force ∷ I|i) m 1021 | force = set "force" <=< buildObj 1022 | 1023 | buildCategories ∷ ∀ i m. Monad m ⇒ CommandsT TP.CategoriesI m ~> CommandsT (categories ∷ I|i) m 1024 | buildCategories = set "categories" <=< buildArr 1025 | 1026 | addCategory ∷ ∀ i m. Monad m ⇒ CommandsT TP.CategoryI m ~> CommandsT (category ∷ I|i) m 1027 | addCategory = set "" <=< buildObj 1028 | 1029 | colorSource ∷ ∀ i m. Monad m ⇒ DSL (color ∷ I|i) m 1030 | colorSource = set' "color" $ toForeign "source" 1031 | 1032 | colorTarget ∷ ∀ i m. Monad m ⇒ DSL (color ∷ I|i) m 1033 | colorTarget = set' "target" $ toForeign "target" 1034 | 1035 | buildCoord ∷ ∀ i m. Monad m ⇒ CommandsT TP.PointI m ~> CommandsT (coord ∷ I|i) m 1036 | buildCoord dsl = do 1037 | Tuple a xx ← get "x" dsl 1038 | Tuple _ yy ← get "y" dsl 1039 | set' "coord" $ toForeign $ Arr.catMaybes [ xx, yy ] 1040 | pure a 1041 | 1042 | buildCenter ∷ ∀ i m. Monad m ⇒ CommandsT TP.PointI m ~> CommandsT (center ∷ I|i) m 1043 | buildCenter dsl = do 1044 | Tuple a xx ← get "x" dsl 1045 | Tuple _ yy ← get "y" dsl 1046 | set' "center" $ toForeign $ Arr.catMaybes [ xx, yy ] 1047 | pure a 1048 | 1049 | buildRadius ∷ ∀ i m. Monad m ⇒ CommandsT TP.RadiusI m ~> CommandsT (radius ∷ I|i) m 1050 | buildRadius dsl = do 1051 | Tuple a s ← get "start" dsl 1052 | Tuple _ e ← get "end" dsl 1053 | set' "radius" $ toForeign $ Arr.concat [s, e] 1054 | pure a 1055 | 1056 | setStart ∷ ∀ i m. Monad m ⇒ CommandsT TP.DimensionI m ~> CommandsT (start ∷ I|i) m 1057 | setStart dsl = do 1058 | Tuple a keys ← lastWithKeys ["pixels", "percents"] dsl 1059 | F.for_ (keys ∷ Array Foreign) $ set' "start" 1060 | pure a 1061 | 1062 | setEnd ∷ ∀ i m. Monad m ⇒ CommandsT TP.DimensionI m ~> CommandsT (end ∷ I|i) m 1063 | setEnd dsl = do 1064 | Tuple a keys ← lastWithKeys ["pixels", "percents"] dsl 1065 | F.for_ (keys ∷ Array Foreign) $ set' "end" 1066 | pure a 1067 | 1068 | setBarWidth ∷ ∀ i m. Monad m ⇒ CommandsT TP.DimensionI m ~> CommandsT (barWidth ∷ I|i) m 1069 | setBarWidth dsl = do 1070 | Tuple a keys ← lastWithKeys ["pixels", "percents"] dsl 1071 | F.for_ (keys ∷ Array Foreign) $ set' "barWidth" 1072 | pure a 1073 | 1074 | setX ∷ ∀ i m. Monad m ⇒ CommandsT TP.DimensionI m ~> CommandsT (x ∷ I|i) m 1075 | setX dsl = do 1076 | Tuple a keys ← lastWithKeys ["pixels", "percents"] dsl 1077 | F.for_ (keys ∷ Array Foreign) $ set' "x" 1078 | pure a 1079 | 1080 | setY ∷ ∀ i m. Monad m ⇒ CommandsT TP.DimensionI m ~> CommandsT (y ∷ I|i) m 1081 | setY dsl = do 1082 | Tuple a keys ← lastWithKeys ["pixels", "percents"] dsl 1083 | F.for_ (keys ∷ Array Foreign) $ set' "y" 1084 | pure a 1085 | 1086 | setZ ∷ ∀ i m. Monad m ⇒ CommandsT TP.DimensionI m ~> CommandsT (z ∷ I|i) m 1087 | setZ dsl = do 1088 | Tuple a keys ← lastWithKeys ["pixels", "percents"] dsl 1089 | F.for_ (keys ∷ Array Foreign) $ set' "z" 1090 | pure a 1091 | 1092 | coordXIx ∷ ∀ i m. Monad m ⇒ Int → DSL (x ∷ I|i) m 1093 | coordXIx = set' "x" <<< toForeign 1094 | 1095 | coordXValue ∷ ∀ i m. Monad m ⇒ String → DSL (x ∷ I|i) m 1096 | coordXValue = set' "x" <<< toForeign 1097 | 1098 | coordY ∷ ∀ i m. Monad m ⇒ String → DSL (y ∷ I|i) m 1099 | coordY = set' "y" <<< toForeign 1100 | 1101 | pixels ∷ ∀ i m. Monad m ⇒ Int → DSL (pixels ∷ I|i) m 1102 | pixels = set' "pixels" <<< toForeign 1103 | 1104 | percents ∷ ∀ i m. Monad m ⇒ Number → DSL (percents ∷ I|i) m 1105 | percents = set' "percents" <<< toForeign <<< (_ <> "%") <<< show 1106 | 1107 | setWidth ∷ ∀ i m. Monad m ⇒ CommandsT TP.DimensionI m ~> CommandsT (width ∷ I|i) m 1108 | setWidth dsl = do 1109 | Tuple a keys ← lastWithKeys ["pixels", "percents"] dsl 1110 | F.for_ (keys ∷ Array Foreign) $ set' "width" 1111 | pure a 1112 | 1113 | buildGaugeRadius ∷ ∀ i m. Monad m ⇒ CommandsT TP.DimensionI m ~> CommandsT (gaugeRadius ∷ I|i) m 1114 | buildGaugeRadius dsl = do 1115 | Tuple a keys ← lastWithKeys ["pixels", "percents"] dsl 1116 | F.for_ (keys ∷ Array Foreign) $ set' "radius" 1117 | pure a 1118 | 1119 | buildOffsetCenter ∷ ∀ i m. Monad m ⇒ CommandsT TP.PointI m ~> CommandsT (offsetCenter ∷ I|i) m 1120 | buildOffsetCenter dsl = do 1121 | Tuple a xx ← get "x" dsl 1122 | Tuple _ yy ← get "y" dsl 1123 | set' "offsetCenter" $ toForeign $ Arr.catMaybes [ xx, yy ] 1124 | pure a 1125 | 1126 | containLabel ∷ ∀ i m. Monad m ⇒ Boolean → DSL (containLabel ∷ I|i) m 1127 | containLabel = set' "containLabel" <<< toForeign 1128 | 1129 | polarCoordinateSystem ∷ ∀ i m. Monad m ⇒ DSL (coordinateSystem ∷ I|i) m 1130 | polarCoordinateSystem = set' "coordinateSystem" $ toForeign "polar" 1131 | 1132 | cartesianCoordinateSystem ∷ ∀ i m. Monad m ⇒ DSL (coordinateSystem ∷ I|i) m 1133 | cartesianCoordinateSystem = set' "coordinateSystem" $ toForeign "cartesian2d" 1134 | 1135 | geoCoordinateSystem ∷ ∀ i m. Monad m ⇒ DSL (coordinateSystem ∷ I|i) m 1136 | geoCoordinateSystem = set' "coordinateSystem" $ toForeign "geo" 1137 | 1138 | calendarCoordinateSystem ∷ ∀ i m. Monad m ⇒ DSL (coordinateSystem ∷ I|i) m 1139 | calendarCoordinateSystem = set' "coordinateSystem" $ toForeign "calendar" 1140 | 1141 | dim ∷ ∀ i m. Monad m ⇒ Int → DSL (dim ∷ I|i) m 1142 | dim = set' "dim" <<< toForeign 1143 | 1144 | nameLocationStart ∷ ∀ i m. Monad m ⇒ DSL (nameLocation ∷ I|i) m 1145 | nameLocationStart = set' "nameLocation" $ toForeign "start" 1146 | 1147 | nameLocationEnd ∷ ∀ i m. Monad m ⇒ DSL (nameLocation ∷ I|i) m 1148 | nameLocationEnd = set' "nameLocation" $ toForeign "end" 1149 | 1150 | nameLocationMiddle ∷ ∀ i m. Monad m ⇒ DSL (nameLocation ∷ I|i) m 1151 | nameLocationMiddle = set' "nameLocation" $ toForeign "middle" 1152 | 1153 | nameTextStyle ∷ ∀ i m. Monad m ⇒ CommandsT TP.TextStyleI m ~> CommandsT (nameTextStyle ∷ I|i) m 1154 | nameTextStyle o = set "nameTextStyle" =<< buildObj o 1155 | 1156 | nameRotate ∷ ∀ i m. Monad m ⇒ Number → DSL (nameRotate ∷ I|i) m 1157 | nameRotate o = set' "nameRotate" $ toForeign o 1158 | 1159 | buildCellSize ∷ ∀ i m. Monad m ⇒ CommandsT TP.ValuesI m ~> CommandsT (cellSize ∷ I|i) m 1160 | buildCellSize = set "cellSize" <=< buildArr 1161 | 1162 | buildRange ∷ ∀ i m. Monad m ⇒ CommandsT TP.ValuesI m ~> CommandsT (range ∷ I|i) m 1163 | buildRange = set "range" <=< buildArr 1164 | 1165 | addDateValue ∷ ∀ i m. Monad m ⇒ Date → DSL (addValue ∷ I|i) m 1166 | addDateValue dt = 1167 | set' "" <<< toForeign 1168 | $ year' dt 1169 | <> "-" 1170 | <> month' dt 1171 | <> "-" 1172 | <> day' dt 1173 | where 1174 | year' = show <<< fromEnum <<< year 1175 | month' = show <<< fromEnum <<< month 1176 | day' = show <<< fromEnum <<< day 1177 | 1178 | useUTC ∷ ∀ i m. Monad m ⇒ Boolean → DSL (useUTC ∷ I|i) m 1179 | useUTC = set' "useUTC" <<< toForeign 1180 | -------------------------------------------------------------------------------- /src/ECharts/Event.js: -------------------------------------------------------------------------------- 1 | function addData(area, axis, setKey) { 2 | if (axis.type !== "value") { 3 | area[setKey] = axis.data; 4 | } else { 5 | area[setKey] = [ ]; 6 | } 7 | return; 8 | } 9 | 10 | // ECharts doesn't send x-axis data in brush events but we need it 11 | // because sorting algo may be opaque 12 | function addAxisData(option, e, axisKey, setKey, axisIndexKey) { 13 | var i, j, gridIndex; 14 | for (i = 0; i < e.areas.length; i++) { 15 | gridIndex = parseInt(e.areas[i].panelId.match(/\d+$/g)[0]); 16 | e.areas[i].gridIndex = gridIndex; 17 | if (typeof option === "undefined") { 18 | e.areas[i][setKey] = [ ]; 19 | e.areas[i][axisIndexKey] = 0; 20 | } else if (typeof option[axisKey].length === "undefined" && gridIndex === 0) { 21 | addData(e.areas[i], option[axisKey], setKey); 22 | e.areas[i][axisIndexKey] = 0; 23 | } else if (option[axisKey].length === 1 && gridIndex === 0) { 24 | addData(e.areas[i], option[axisKey][0], setKey); 25 | e.areas[i][axisIndexKey] = 0; 26 | } else { 27 | for (j = 0; j < option[axisKey].length; j++) { 28 | if (option[axisKey][j].gridIndex === gridIndex) { 29 | addData(e.areas[i], option[axisKey][j], setKey); 30 | e.areas[i][axisIndexKey] = j; 31 | } 32 | } 33 | } 34 | } 35 | return e; 36 | } 37 | 38 | function addXAxisData(option, e) { 39 | return addAxisData(option, e, "xAxis", "xAxisData", "xAxisIndex"); 40 | } 41 | 42 | function addYAxisData(option, e) { 43 | return addAxisData(option, e, "yAxis", "yAxisData", "yAxisIndex"); 44 | } 45 | 46 | function addSeriesAndTitles(option, e) { 47 | var i, xIx, yIx, serie, ai, area; 48 | for (ai = 0; ai < e.areas.length; ai++) { 49 | area = e.areas[ai]; 50 | area.serieNames = []; 51 | area.serieIndices = []; 52 | for (i = 0; i < option.series.length; i++) { 53 | serie = option.series[i]; 54 | xIx = serie.xAxisIndex || 0; 55 | yIx = serie.xAxisIndex || 0; 56 | if (xIx == area.xAxisIndex && yIx == area.yAxisIndex) { 57 | area.serieNames.push(serie.name); 58 | area.serieIndices.push(i); 59 | } 60 | } 61 | } 62 | var titles, titleTexts = []; 63 | if (!option.title) { 64 | titles = []; 65 | } else if (typeof option.title.length === "undefined") { 66 | titles = [option.title]; 67 | } else { 68 | titles = option.title; 69 | } 70 | for (i = 0; i < titles.length; i++) { 71 | if (titles[i].text) titleTexts.push(titles[i].text); 72 | } 73 | e.titleTexts = titleTexts; 74 | return e; 75 | } 76 | 77 | function addAll(option, e) { 78 | return addSeriesAndTitles(option, addYAxisData(option, addXAxisData(option, e))); 79 | } 80 | 81 | exports.on_ = function(chart) { 82 | return function(eName) { 83 | return function(callback) { 84 | return function() { 85 | return chart.on(eName, function(e) { 86 | if (eName === "brush") { 87 | addAll(this.getOption(), e); 88 | } 89 | callback(e)(); 90 | }); 91 | }; 92 | }; 93 | }; 94 | }; 95 | 96 | exports.dispatchAction_ = function(action) { 97 | return function(chart) { 98 | return function() { 99 | try { 100 | return chart.dispatchAction(action); 101 | } finally { 102 | return; 103 | } 104 | }; 105 | }; 106 | } 107 | -------------------------------------------------------------------------------- /src/ECharts/Event.purs: -------------------------------------------------------------------------------- 1 | module ECharts.Event (listenAll, dispatch, on_) where 2 | 3 | import Prelude 4 | 5 | import Control.Monad.Eff (Eff) 6 | import Control.Monad.Eff.Class (liftEff, class MonadEff) 7 | import Control.Monad.Except (runExcept) 8 | import Data.Foldable (for_) 9 | import Data.Foreign (Foreign, readString) 10 | import Data.Foreign.Index (readProp) 11 | import Data.List as L 12 | import Data.Record.Unsafe as R 13 | import Data.Tuple (Tuple(..), fst, snd) 14 | import Data.Variant.Internal (RLProxy(..), variantTags, class VariantTags) 15 | import ECharts.Types (EChartsEvent, EChartsEventR, Chart, ECHARTS) 16 | import Type.Row (class RowToList) 17 | import Unsafe.Coerce (unsafeCoerce) 18 | 19 | foreign import on_ 20 | ∷ ∀ e 21 | . Chart 22 | → String 23 | → ( Foreign → Eff (echarts ∷ ECHARTS|e) Unit ) 24 | → Eff (echarts ∷ ECHARTS|e) Unit 25 | 26 | listenAll 27 | ∷ ∀ e m 28 | . MonadEff ( echarts ∷ ECHARTS |e ) m 29 | ⇒ Chart 30 | → ( EChartsEvent → Eff (echarts ∷ ECHARTS|e) Unit ) 31 | → m Unit 32 | listenAll chart cb = liftEff $ 33 | for_ eventNames \en → on_ chart en \frn → 34 | for_ (runExcept $ readProp "type" frn >>= readString) \tp → 35 | when (tp == en) $ cb $ toEChartsEvent $ Tuple tp frn 36 | where 37 | eventNames ∷ ∀ rl. RowToList EChartsEventR rl ⇒ VariantTags rl ⇒ L.List String 38 | eventNames = variantTags (RLProxy ∷ RLProxy rl) 39 | 40 | toEChartsEvent ∷ ∀ ω. Tuple String ω → EChartsEvent 41 | toEChartsEvent = unsafeCoerce 42 | 43 | foreign import dispatchAction_ 44 | ∷ ∀ e action 45 | . action 46 | → Chart 47 | → Eff ( echarts ∷ ECHARTS |e ) Unit 48 | 49 | dispatch 50 | ∷ ∀ e m 51 | . MonadEff ( echarts ∷ ECHARTS | e ) m 52 | ⇒ EChartsEvent 53 | → Chart 54 | → m Unit 55 | dispatch vaction chart = 56 | liftEff $ dispatchAction_ action chart 57 | where 58 | variantPair ∷ Tuple String {} 59 | variantPair = unsafeCoerce vaction 60 | 61 | actionType ∷ String 62 | actionType = case fst variantPair of 63 | "legendselectchanged" → "legendToggleSelect" 64 | "legendselected" → "legendSelect" 65 | "legendunselected" → "legendUnSelect" 66 | "datazoom" → "dataZoom" 67 | "datarangeselected" → "selectDataRange" 68 | "timelinechanged" → "timelineChange" 69 | "timelineplaychanged" → "timelinePlayChange" 70 | "pieselectchanged" → "pieToggleSelect" 71 | "pieselected" → "pieSelect" 72 | "pieunselected" → "pieUnSelect" 73 | "mapselectchanged" → "mapToggleSelect" 74 | "mapselected" → "mapSelect" 75 | "mapunselected" → "mapUnSelect" 76 | "focusnodeadjacency" → "focusNodeAdjacency" 77 | "unfocusnodeadjacency" → "unfocusNodeAdjacency" 78 | s → s 79 | 80 | action ∷ ∀ ω. { "type" ∷ String | ω } 81 | action = R.unsafeSet "type" actionType $ snd variantPair 82 | -------------------------------------------------------------------------------- /src/ECharts/Internal.js: -------------------------------------------------------------------------------- 1 | exports.unsafeSetField = function(obj) { 2 | return function(key) { 3 | return function(val) { 4 | obj[key] = val; 5 | return obj; 6 | }; 7 | }; 8 | }; 9 | 10 | exports.emptyObject = function() { 11 | return {}; 12 | }; 13 | 14 | exports.undefinedValue = undefined; 15 | -------------------------------------------------------------------------------- /src/ECharts/Internal.purs: -------------------------------------------------------------------------------- 1 | module ECharts.Internal where 2 | 3 | import Prelude 4 | 5 | import Data.Foreign (Foreign) 6 | 7 | foreign import unsafeSetField 8 | ∷ Foreign → String → Foreign → Foreign 9 | 10 | foreign import emptyObject 11 | ∷ Unit → Foreign 12 | 13 | foreign import undefinedValue 14 | ∷ Foreign 15 | -------------------------------------------------------------------------------- /src/ECharts/Monad.purs: -------------------------------------------------------------------------------- 1 | module ECharts.Monad where 2 | 3 | import Prelude 4 | 5 | import Control.Alt (class Alt) 6 | import Control.Alternative (class Alternative) 7 | import Control.Monad.Aff.Class (class MonadAff) 8 | import Control.Monad.Cont.Class (class MonadCont) 9 | import Control.Monad.Eff (kind Effect) 10 | import Control.Monad.Eff.Class (class MonadEff) 11 | import Control.Monad.Error.Class (class MonadError, class MonadThrow) 12 | import Control.Monad.Reader.Class (class MonadAsk, class MonadReader) 13 | import Control.Monad.Rec.Class (class MonadRec) 14 | import Control.Monad.State.Class (class MonadState) 15 | import Control.Monad.Trans.Class (class MonadTrans, lift) 16 | import Control.Monad.Writer.Class (class MonadTell, class MonadWriter, tell) 17 | import Control.Monad.Writer.Trans (WriterT, execWriterT, runWriterT) 18 | import Control.MonadPlus (class MonadPlus) 19 | import Control.MonadZero (class MonadZero) 20 | import Control.Plus (class Plus, empty) 21 | import Data.Array as Arr 22 | import Data.Bifunctor (rmap) 23 | import Data.Foldable as F 24 | import Data.Foreign (Foreign, toForeign) 25 | import Data.Identity (Identity) 26 | import Data.Maybe (Maybe(..), maybe) 27 | import Data.Newtype (class Newtype, unwrap) 28 | import Data.Tuple (Tuple(..), uncurry, snd, lookup) 29 | import ECharts.Internal (unsafeSetField, emptyObject) 30 | import ECharts.Types as ET 31 | 32 | type KeyVal = Tuple String Foreign 33 | type Pairs = Array KeyVal 34 | 35 | newtype CommandsT (i ∷ # Effect) m a = CommandsT (WriterT Pairs m a) 36 | 37 | type DSL i m = CommandsT i m Unit 38 | type DSL' i = CommandsT i Identity Unit 39 | 40 | derive instance newtypeCommandsT 41 | ∷ Newtype (CommandsT i m a) _ 42 | derive newtype instance functorDSL 43 | ∷ Functor m ⇒ Functor (CommandsT i m) 44 | derive newtype instance applyDSL 45 | ∷ Apply m ⇒ Apply (CommandsT i m) 46 | derive newtype instance applicativeDSL 47 | ∷ Applicative m ⇒ Applicative (CommandsT i m) 48 | derive newtype instance bindDSL 49 | ∷ Bind m ⇒ Bind (CommandsT i m) 50 | derive newtype instance monadDSL 51 | ∷ Monad m ⇒ Monad (CommandsT i m) 52 | derive newtype instance monadTellCommandsT 53 | ∷ Monad m ⇒ MonadTell (Array (Tuple String Foreign)) (CommandsT i m) 54 | derive newtype instance monadWriterCommandsT 55 | ∷ Monad m ⇒ MonadWriter (Array (Tuple String Foreign)) (CommandsT i m) 56 | derive newtype instance plusCommandsT 57 | ∷ Plus m ⇒ Plus (CommandsT i m) 58 | derive newtype instance altCommandsT 59 | ∷ Alt m ⇒ Alt (CommandsT i m) 60 | derive newtype instance alternativeCommandsT 61 | ∷ Alternative m ⇒ Alternative (CommandsT i m) 62 | derive newtype instance monadRecCommandsT 63 | ∷ MonadRec m ⇒ MonadRec (CommandsT i m) 64 | derive newtype instance monadZeroCommandsT 65 | ∷ MonadZero m ⇒ MonadZero (CommandsT i m) 66 | derive newtype instance monadPlusCommandsT 67 | ∷ MonadPlus m ⇒ MonadPlus (CommandsT i m) 68 | derive newtype instance monadAffCommandsT 69 | ∷ MonadAff e m ⇒ MonadAff e (CommandsT i m) 70 | derive newtype instance monadEffCommandsT 71 | ∷ MonadEff e m ⇒ MonadEff e (CommandsT i m) 72 | derive newtype instance monadContCommandsT 73 | ∷ MonadCont m ⇒ MonadCont (CommandsT i m) 74 | derive newtype instance monadThrowCommandsT 75 | ∷ MonadThrow e m ⇒ MonadThrow e (CommandsT i m) 76 | derive newtype instance monadErrorCommandsT 77 | ∷ MonadError e m ⇒ MonadError e (CommandsT i m) 78 | derive newtype instance monadAskCommandsT 79 | ∷ MonadAsk r m ⇒ MonadAsk r (CommandsT i m) 80 | derive newtype instance monadReaderCommandsT 81 | ∷ MonadReader r m ⇒ MonadReader r (CommandsT i m) 82 | derive newtype instance monadStateCommandsT 83 | ∷ MonadState s m ⇒ MonadState s (CommandsT i m) 84 | 85 | derive newtype instance monadTransCommandsT ∷ MonadTrans (CommandsT i) 86 | 87 | set' ∷ ∀ m. MonadTell Pairs m ⇒ String → Foreign → m Unit 88 | set' k v = tell $ Arr.singleton $ Tuple k v 89 | 90 | set ∷ ∀ m a. MonadTell Pairs m ⇒ String → Tuple a Foreign → m a 91 | set k (Tuple a v) = do 92 | tell $ Arr.singleton $ Tuple k v 93 | pure a 94 | 95 | get 96 | ∷ ∀ i m f a ii 97 | . Monad m 98 | ⇒ Alternative f 99 | ⇒ String 100 | → CommandsT i m a 101 | → CommandsT ii m (Tuple a (f Foreign)) 102 | get k cs = 103 | lift 104 | $ unwrap cs 105 | # runWriterT 106 | >>> map (rmap (maybe empty pure <<< lookup k)) 107 | 108 | lastWithKeys 109 | ∷ ∀ i f m w a ii 110 | . F.Foldable f 111 | ⇒ Monad m 112 | ⇒ Alternative w 113 | ⇒ f String 114 | → CommandsT i m a 115 | → CommandsT ii m (Tuple a (w Foreign)) 116 | lastWithKeys ks cs = 117 | lift 118 | $ unwrap cs 119 | # runWriterT 120 | >>> map (rmap (maybe empty pure <<< F.foldl (lookup' ks) Nothing)) 121 | where 122 | lookup' ∷ f String → Maybe Foreign → Tuple String Foreign → Maybe Foreign 123 | lookup' ks' Nothing (Tuple kk f) | F.elem kk ks' = Just f 124 | lookup' _ a _ = a 125 | 126 | applyOnePair ∷ Tuple String Foreign → Foreign → Foreign 127 | applyOnePair opt obj = uncurry (unsafeSetField obj) opt 128 | 129 | interpretT ∷ ∀ i m a. Functor m ⇒ CommandsT i m a → m ET.Option 130 | interpretT cs = 131 | map ET.Option $ unwrap cs # execWriterT >>> map (F.foldl (flip applyOnePair) $ emptyObject unit) 132 | 133 | interpret ∷ ∀ i. DSL' i → ET.Option 134 | interpret = unwrap <<< interpretT 135 | 136 | buildObj ∷ ∀ i m a ii. Monad m ⇒ CommandsT i m a → CommandsT ii m (Tuple a Foreign) 137 | buildObj cs = 138 | lift $ unwrap cs # runWriterT >>> map (rmap $ F.foldl (flip applyOnePair) $ emptyObject unit) 139 | 140 | buildSeries ∷ ∀ i m a ii. Monad m ⇒ CommandsT i m a → CommandsT ii m (Tuple a Foreign) 141 | buildSeries cs = 142 | lift $ unwrap cs # runWriterT >>> map (rmap $ toForeign <<< typify) 143 | where 144 | typify = map \(Tuple ty f) → unsafeSetField f "type" $ toForeign ty 145 | 146 | buildArr ∷ ∀ i m a ii. Monad m ⇒ CommandsT i m a → CommandsT ii m (Tuple a Foreign) 147 | buildArr cs = 148 | lift $ unwrap cs # runWriterT >>> map (rmap $ toForeign <<< map snd) 149 | -------------------------------------------------------------------------------- /src/ECharts/Theme.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | exports._dark = { name: "dark", value: require("echarts/theme/dark") }; 4 | exports._infographic = { name: "infographic", value: require("echarts/theme/infographic") }; 5 | exports._macarons = { name: "macarons", value: require("echarts/theme/macarons") }; 6 | exports._roma = { name: "roma", value: require("echarts/theme/roma") }; 7 | exports._shine = { name: "shine", value: require("echarts/theme/shine") }; 8 | exports._vintage = { name: "vintage", value: require("echarts/theme/vintage") }; 9 | 10 | exports.builtInThemeName = function (theme) { 11 | return theme.name; 12 | }; 13 | -------------------------------------------------------------------------------- /src/ECharts/Theme.purs: -------------------------------------------------------------------------------- 1 | module ECharts.Theme 2 | ( Theme(..) 3 | , BuiltInTheme 4 | , builtInThemeName 5 | , dark 6 | , infographic 7 | , macarons 8 | , roma 9 | , shine 10 | , vintage 11 | ) where 12 | 13 | import Data.Either (Either(..)) 14 | import Data.Foreign (Foreign) 15 | 16 | type Theme = Either BuiltInTheme Foreign 17 | 18 | foreign import data BuiltInTheme :: Type 19 | 20 | foreign import builtInThemeName :: BuiltInTheme -> String 21 | 22 | dark :: Theme 23 | dark = Left _dark 24 | 25 | infographic :: Theme 26 | infographic = Left _infographic 27 | 28 | macarons :: Theme 29 | macarons = Left _macarons 30 | 31 | roma :: Theme 32 | roma = Left _roma 33 | 34 | shine :: Theme 35 | shine = Left _shine 36 | 37 | vintage :: Theme 38 | vintage = Left _vintage 39 | 40 | foreign import _dark :: BuiltInTheme 41 | foreign import _infographic :: BuiltInTheme 42 | foreign import _macarons :: BuiltInTheme 43 | foreign import _roma :: BuiltInTheme 44 | foreign import _shine :: BuiltInTheme 45 | foreign import _vintage :: BuiltInTheme 46 | -------------------------------------------------------------------------------- /src/ECharts/Types.purs: -------------------------------------------------------------------------------- 1 | module ECharts.Types where 2 | 3 | import Prelude 4 | 5 | import Control.Monad.Eff (kind Effect) 6 | import Data.Foreign (Foreign, toForeign) 7 | import Data.Variant as V 8 | import Data.StrMap as SM 9 | 10 | foreign import data Chart ∷ Type 11 | 12 | -- | For Eff computation 13 | foreign import data ECHARTS ∷ Effect 14 | 15 | data TooltipTrigger 16 | = ItemTrigger 17 | | AxisTrigger 18 | 19 | tooltipTriggerToForeign ∷ TooltipTrigger → Foreign 20 | tooltipTriggerToForeign = toForeign <<< case _ of 21 | ItemTrigger → "item" 22 | AxisTrigger → "axis" 23 | 24 | data PixelOrPercent 25 | = Pixel Int 26 | | Percent Number 27 | 28 | pixelOrPercentToForeign ∷ PixelOrPercent → Foreign 29 | pixelOrPercentToForeign = case _ of 30 | Pixel i → toForeign i 31 | Percent n → toForeign $ show n <> "%" 32 | 33 | data Orient 34 | = Vertical 35 | | Horizontal 36 | 37 | orientToForeign ∷ Orient → Foreign 38 | orientToForeign = toForeign <<< case _ of 39 | Vertical → "vertical" 40 | Horizontal → "horizontal" 41 | 42 | data AxisType 43 | = Category 44 | | Value 45 | | Time 46 | | Log 47 | 48 | axisTypeToForeign ∷ AxisType → Foreign 49 | axisTypeToForeign = toForeign <<< case _ of 50 | Category → "category" 51 | Value → "value" 52 | Time → "time" 53 | Log → "log" 54 | 55 | data Symbol 56 | = Circle 57 | | Rect 58 | | RoundRect 59 | | Triangle 60 | | Diamond 61 | | Pin 62 | | Arrow 63 | | EmptyCircle 64 | | None 65 | 66 | symbolToForeign ∷ Symbol → Foreign 67 | symbolToForeign = toForeign <<< case _ of 68 | Circle → "circle" 69 | Rect → "rect" 70 | RoundRect → "roundRect" 71 | Triangle → "triangle" 72 | Diamond → "diamond" 73 | Pin → "pin" 74 | Arrow → "arrow" 75 | EmptyCircle → "emptyCircle" 76 | None → "none" 77 | 78 | 79 | newtype Point = Point { x ∷ PixelOrPercent, y ∷ PixelOrPercent } 80 | pointToForeign ∷ Point → Foreign 81 | pointToForeign (Point {x, y}) = 82 | toForeign [ pixelOrPercentToForeign x, pixelOrPercentToForeign y ] 83 | 84 | newtype Radius = Radius { start ∷ PixelOrPercent, end ∷ PixelOrPercent } 85 | radiusToForeign ∷ Radius → Foreign 86 | radiusToForeign (Radius {start, end}) = 87 | toForeign [ pixelOrPercentToForeign start, pixelOrPercentToForeign end ] 88 | 89 | newtype SingleValueRadius = SingleValueRadius PixelOrPercent 90 | singleValueRadiusToForeign ∷ SingleValueRadius → Foreign 91 | singleValueRadiusToForeign (SingleValueRadius r) = pixelOrPercentToForeign r 92 | 93 | numItem ∷ Number → Item 94 | numItem = Item <<< toForeign 95 | 96 | strItem ∷ String → Item 97 | strItem = Item <<< toForeign 98 | 99 | numArrItem ∷ Array Number → Item 100 | numArrItem = Item <<< toForeign 101 | 102 | strArrItem ∷ Array String → Item 103 | strArrItem = Item <<< toForeign 104 | 105 | data PointerType 106 | = LinePointer 107 | | CrossPointer 108 | | ShadowPointer 109 | 110 | pointerTypeToForeign ∷ PointerType → Foreign 111 | pointerTypeToForeign = toForeign <<< case _ of 112 | LinePointer → "line" 113 | CrossPointer → "cross" 114 | ShadowPointer → "shadow" 115 | 116 | data LineType 117 | = SolidLine 118 | | DashedLine 119 | | DottedLine 120 | 121 | lineTypeToForeign ∷ LineType → Foreign 122 | lineTypeToForeign = toForeign <<< case _ of 123 | SolidLine → "solid" 124 | DashedLine → "dashed" 125 | DottedLine → "dotted" 126 | 127 | pairItem ∷ Number → Number → Item 128 | pairItem x y = Item $ toForeign [ x, y ] 129 | 130 | type FormatterInput = 131 | { componentType ∷ String 132 | , seriesIndex ∷ Int 133 | , seriesName ∷ String 134 | , name ∷ String 135 | , dataIndex ∷ Int 136 | , "data" ∷ Item -- ??? 137 | , value ∷ Foreign 138 | , color ∷ String 139 | , percent ∷ Number 140 | , dataType ∷ String 141 | } 142 | 143 | type FormatterInputArrayValue = 144 | { componentType ∷ String 145 | , seriesIndex ∷ Int 146 | , seriesName ∷ String 147 | , name ∷ String 148 | , dataIndex ∷ Int 149 | , "data" ∷ Item 150 | , value ∷ Array Foreign 151 | , color ∷ String 152 | , percent ∷ Number 153 | } 154 | 155 | data SelectedMode 156 | = Single 157 | | Multiple 158 | | Disabled 159 | 160 | selectedModeToForeign ∷ SelectedMode → Foreign 161 | selectedModeToForeign = case _ of 162 | Single → toForeign "single" 163 | Multiple → toForeign "multiple" 164 | Disabled → toForeign false 165 | 166 | data HorizontalPosition 167 | = LeftHP 168 | | RightHP 169 | | CenterHP 170 | 171 | horizontalPositionToForeign ∷ HorizontalPosition → Foreign 172 | horizontalPositionToForeign = toForeign <<< case _ of 173 | LeftHP → "left" 174 | RightHP → "right" 175 | CenterHP → "center" 176 | 177 | newtype Item = Item Foreign 178 | newtype Coord = Coord Foreign 179 | 180 | coord ∷ Number → Number → Coord 181 | coord x y = Coord $ toForeign [ x, y ] 182 | 183 | type LegendEventR = 184 | { name ∷ String 185 | , selected ∷ SM.StrMap Boolean 186 | } 187 | 188 | type DataRangeEventR = 189 | { visualMapId ∷ String 190 | , selected ∷ Array Number 191 | } 192 | 193 | type ClickEventR = 194 | { seriesName ∷ String 195 | , name ∷ String 196 | , dataIndex ∷ Int 197 | , seriesIndex ∷ Int 198 | } 199 | 200 | type BrushEventAreaR = 201 | { brushType ∷ String 202 | , panelId ∷ String 203 | , coordRange ∷ Array Foreign 204 | , xAxisData ∷ Array String 205 | , yAxisData ∷ Array String 206 | , gridIndex ∷ Int 207 | } 208 | 209 | type BrushEventR = 210 | { areas ∷ Array BrushEventAreaR 211 | , titleTexts ∷ Array String 212 | } 213 | 214 | type EChartsEventR = 215 | ( click ∷ ClickEventR 216 | , dblclick ∷ Foreign 217 | , mousedown ∷ Foreign 218 | , mousemove ∷ Foreign 219 | , mouseup ∷ Foreign 220 | , mouseover ∷ Foreign 221 | , mouseout ∷ Foreign 222 | , legendselectchanged ∷ LegendEventR 223 | , legendselected ∷ LegendEventR 224 | , legendunselected ∷ LegendEventR 225 | , datazoom ∷ Foreign 226 | , datarangeselected ∷ DataRangeEventR 227 | , timelinechanged ∷ Foreign 228 | , timelineplaychanged ∷ Foreign 229 | , restore ∷ Foreign 230 | , dataviewchanged ∷ Foreign 231 | , magictypechanged ∷ Foreign 232 | -- This is not absolutely accurate, but working with pieselectchanged 233 | -- is too painful 234 | , pieselectchanged ∷ ClickEventR 235 | , pieselected ∷ ClickEventR 236 | , pieunselected ∷ ClickEventR 237 | , mapselectchanged ∷ Foreign 238 | , mapselected ∷ Foreign 239 | , mapunselected ∷ Foreign 240 | , axisareaselected ∷ Foreign 241 | , focusNodeAdjancency ∷ Foreign 242 | , unfocusNodeAdjacency ∷ Foreign 243 | , brush ∷ BrushEventR 244 | , brushselected ∷ BrushEventR 245 | , pieSelect ∷ Foreign 246 | , pieUnSelect ∷ Foreign 247 | ) 248 | 249 | type EChartsEvent = V.Variant EChartsEventR 250 | newtype Option = Option Foreign 251 | -------------------------------------------------------------------------------- /src/ECharts/Types/Phantom.purs: -------------------------------------------------------------------------------- 1 | module ECharts.Types.Phantom where 2 | 3 | import Control.Monad.Eff (kind Effect) 4 | 5 | -- | Phantom effect for DSL 6 | foreign import data I ∷ Effect 7 | -- | Takes row of effects and returns an effect. Useful for emulating structural polymorphism. 8 | foreign import data R ∷ (# Effect → Effect) 9 | 10 | -- | Open rows synonims are for mixins 11 | -- | closed rows are for complete dsls 12 | 13 | type CoordinateSystemMixin i = 14 | ( coordinateSystem ∷ I |i) 15 | 16 | type PositionMixin i = 17 | ( left ∷ I 18 | , right ∷ I 19 | , bottom ∷ I 20 | , top ∷ I 21 | | i) 22 | 23 | type ZMixin i = 24 | ( zlevel ∷ I 25 | , z ∷ I 26 | | i) 27 | 28 | type SizeMixin i = 29 | ( width ∷ I 30 | , height ∷ I 31 | | i) 32 | 33 | type BorderAndBackgroundMixin i = 34 | ( borderWidth ∷ I 35 | , borderColor ∷ I 36 | , backgroundColor ∷ I 37 | | i) 38 | 39 | type ShadowMixin i = 40 | ( shadowBlur ∷ I 41 | , shadowOffsetX ∷ I 42 | , shadowOffsetY ∷ I 43 | , shadowColor ∷ I 44 | | i) 45 | 46 | type BaseAnimationMixin i = 47 | ( animationDuration ∷ I 48 | , animationEasing ∷ I 49 | , animationDelay ∷ I 50 | | i) 51 | 52 | type LargeMixin i = 53 | ( large ∷ I 54 | , largeThreshold ∷ I 55 | | i) 56 | 57 | type AnimationMixin i = 58 | BaseAnimationMixin 59 | ( animation ∷ I 60 | , animationThreshold ∷ I 61 | , animationDurationUpdate ∷ I 62 | , animationEasingUpdate ∷ I 63 | , animationDelayUpdate ∷ I 64 | | i) 65 | 66 | type MarkerMixin i = 67 | ( markPoint ∷ I 68 | , markLine ∷ I 69 | , markArea ∷ I 70 | | i) 71 | 72 | type SymbolMixin i = 73 | ( symbol ∷ I 74 | , symbolSize ∷ I 75 | , symbolRotate ∷ I 76 | , symbolOffset ∷ I 77 | | i) 78 | 79 | type MinMaxMixin i = 80 | ( min ∷ I 81 | , max ∷ I 82 | | i) 83 | 84 | type NameStyleMixin i = 85 | ( nameLocation ∷ I 86 | , nameTextStyle ∷ I 87 | , nameGap ∷ I 88 | , nameRotate ∷ I 89 | | i) 90 | 91 | type LegendHoverMixin i = 92 | ( legendHoverLink ∷ I 93 | , hoverAnimation ∷ I 94 | | i) 95 | 96 | 97 | type NormalAndEmphasis i = 98 | ( normal ∷ R i 99 | , emphasis ∷ R i) 100 | 101 | type LegendI = 102 | PositionMixin 103 | (ZMixin 104 | (SizeMixin 105 | (ShadowMixin 106 | (BorderAndBackgroundMixin 107 | ( show ∷ I 108 | , items ∷ I 109 | , orient ∷ I 110 | , align ∷ I 111 | , padding ∷ I 112 | , itemGap ∷ I 113 | , itemWidth ∷ I 114 | , itemHeight ∷ I 115 | , formatter ∷ I 116 | , inactiveColor ∷ I 117 | , selected ∷ I 118 | , textStyle ∷ I 119 | , selectedMode ∷ I 120 | , tooltip ∷ I))))) 121 | 122 | type TooltipI = 123 | ZMixin 124 | (BorderAndBackgroundMixin 125 | ( show ∷ I 126 | , showContent ∷ I 127 | , trigger ∷ I 128 | , triggerOn ∷ I 129 | , alwaysShowContent ∷ I 130 | , showDelay ∷ I 131 | , hideDelay ∷ I 132 | , enterable ∷ I 133 | , position ∷ I 134 | , transitionDuration ∷ I 135 | , formatter ∷ I 136 | , animation ∷ I 137 | , textStyle ∷ I 138 | , padding ∷ I 139 | , extraCssText ∷ I --??? 140 | , axisPointer ∷ I)) 141 | 142 | type CrossStyleI = 143 | ( color ∷ I 144 | , width ∷ I 145 | , lineType ∷ I 146 | , textStyle ∷ I) 147 | 148 | type TitlesI = 149 | ( title ∷ I ) 150 | 151 | type TitleI = 152 | PositionMixin 153 | (ZMixin 154 | (ShadowMixin 155 | (BorderAndBackgroundMixin 156 | ( text ∷ I 157 | , textStyle ∷ I 158 | , offsetCenter ∷ I 159 | , show ∷ I 160 | , subtext ∷ I 161 | , link ∷ I 162 | , target ∷ I 163 | , textAlign ∷ I 164 | , textBaseline ∷ I 165 | , sublink ∷ I 166 | , subtarget ∷ I 167 | , subtextStyle ∷ I 168 | , padding ∷ I 169 | , itemGap ∷ I)))) 170 | 171 | type OptionI = 172 | AnimationMixin 173 | ( tooltip ∷ I 174 | , grid ∷ I 175 | , xAxis ∷ I 176 | , yAxis ∷ I 177 | , color ∷ I 178 | , series ∷ I 179 | , legend ∷ I 180 | , title ∷ I 181 | , backgroundColor ∷ I 182 | , brush ∷ I 183 | , toolbox ∷ I 184 | , visualMap ∷ I 185 | , calendar :: I 186 | , radar ∷ I 187 | , polar ∷ I 188 | , radiusAxis ∷ I 189 | , angleAxis ∷ I 190 | , dataZoom ∷ I 191 | , geo ∷ I 192 | , parallel ∷ I 193 | , parallelAxis ∷ I 194 | , singleAxis ∷ I 195 | , timeline ∷ I 196 | , textStyle ∷ I 197 | , progressive ∷ I 198 | , progressiveThreshold ∷ I 199 | , blendMode ∷ I 200 | , useUTC :: I 201 | , hoverLayerThreshold ∷ I) 202 | 203 | type TimelineI = 204 | PositionMixin 205 | (ZMixin 206 | (SymbolMixin 207 | ( show ∷ I 208 | , timelineType ∷ I 209 | , axisType ∷ I 210 | , currentIndex ∷ I 211 | , autoPlay ∷ I 212 | , rewind ∷ I 213 | , loop ∷ I 214 | , playInterval ∷ I 215 | , realtime ∷ I 216 | , controlPosition ∷ I 217 | , orient ∷ I 218 | , inverse ∷ I 219 | , lineStyle ∷ R LineStyleI 220 | , label ∷ I 221 | , itemStyle ∷ I 222 | , checkpointStyle ∷ I 223 | , controlStyle ∷ I 224 | , items ∷ I))) 225 | 226 | type ParallelsI = 227 | ( parallel ∷ I ) 228 | 229 | type ParallelI = 230 | PositionMixin 231 | (ZMixin 232 | (SizeMixin 233 | ( layout ∷ I 234 | , axisExpandable ∷ I 235 | , axisExpandCenter ∷ I 236 | , axisExpandCount ∷ I 237 | , axisExpandWidth ∷ I 238 | , parallelAxisDefault ∷ I))) 239 | 240 | type GeoI = 241 | PositionMixin 242 | (ZMixin 243 | ( show ∷ I 244 | , map ∷ I 245 | , roam ∷ I 246 | , center ∷ I 247 | , zoom ∷ I 248 | , scaleLimit ∷ I 249 | , nameMap ∷ I 250 | , selectedMode ∷ I 251 | , label ∷ I 252 | , itemStyle ∷ I 253 | , layoutCenter ∷ I 254 | , layoutSize ∷ I 255 | , regions ∷ I 256 | , silent ∷ I)) 257 | 258 | type PolarI = 259 | ZMixin 260 | ( center ∷ I 261 | , radius ∷ I) 262 | 263 | type RadarsI = 264 | ( radar ∷ I ) 265 | 266 | type RadarI = 267 | ZMixin 268 | ( indicators ∷ I 269 | , shape ∷ I 270 | , splitNumber ∷ I 271 | , radarName ∷ I 272 | , splitLine ∷ I 273 | , splitArea ∷ I 274 | , axisLine ∷ I 275 | , center ∷ I 276 | , radius ∷ I 277 | , startAngle ∷ I 278 | , nameGap ∷ I 279 | , scale ∷ I 280 | , silent ∷ I 281 | , triggerEvent ∷ I 282 | , axisTick ∷ I 283 | , axisLabel ∷ I) 284 | 285 | type IndicatorsI = 286 | ( indicator ∷ I ) 287 | 288 | type IndicatorI = 289 | MinMaxMixin 290 | ( name ∷ I) 291 | 292 | type RadarNameI = 293 | ( show ∷ I 294 | , formatter ∷ I 295 | , textStyle ∷ I) 296 | 297 | 298 | type DataZoomI = 299 | ( insideDataZoom ∷ I 300 | , sliderDataZoom ∷ I 301 | ) 302 | 303 | type DataZoomMixinI i = 304 | ( xAxisIndex ∷ I 305 | , yAxisIndex ∷ I 306 | , filterMode ∷ I 307 | , start ∷ I 308 | , end ∷ I 309 | , startValue ∷ I 310 | , endValue ∷ I 311 | , orient ∷ I 312 | , zoomLock ∷ I 313 | , throttle ∷ I 314 | | i) 315 | 316 | type InsideDataZoomI = DataZoomMixinI () 317 | 318 | type SliderDataZoomI = 319 | PositionMixin 320 | (ZMixin 321 | ( show ∷ I 322 | , backgroundColor ∷ I 323 | , dataBackground ∷ I 324 | , fillerColor ∷ I 325 | , borderColor ∷ I 326 | , handleIcon ∷ I 327 | , handleSize ∷ I 328 | , handleStyle ∷ I 329 | , labelPrecision ∷ I 330 | , labelFormatter ∷ I 331 | , showDetail ∷ I 332 | , showDataShadow ∷ I 333 | , realtime ∷ I 334 | , textStyle ∷ I)) 335 | 336 | type DataBackgroundI = 337 | ( lineStyle ∷ R LineStyleI 338 | , areaStyle ∷ R AreaStyleI) 339 | 340 | type HandleStyleI = 341 | ShadowMixin 342 | ( color ∷ I 343 | , borderColor ∷ I 344 | , borderWidth ∷ I 345 | , borderType ∷ I 346 | , opacity ∷ I) 347 | 348 | type VisualMapI = 349 | ( continuousVisualMap ∷ I 350 | , piecewiseVisualMap ∷ I) 351 | 352 | type CalendarI = 353 | ( calendarSpec :: I ) 354 | 355 | type CalendarSpecI = 356 | PositionMixin 357 | (ZMixin 358 | (SizeMixin 359 | ( range :: I 360 | , cellSize :: I 361 | , orient :: I ))) 362 | 363 | type ContinuousVisualMapI = 364 | PositionMixin 365 | (ZMixin 366 | (BorderAndBackgroundMixin 367 | (MinMaxMixin 368 | ( dimension ∷ I 369 | , textPair ∷ I 370 | , inverse ∷ I 371 | , itemHeight ∷ I 372 | , calculable ∷ I 373 | , inRange ∷ I 374 | , outOfRange ∷ I 375 | , controller ∷ I 376 | , orient ∷ I 377 | , range ∷ I 378 | , realtime ∷ I 379 | , precision ∷ I 380 | , itemWidth ∷ I 381 | , align ∷ I 382 | , textGap ∷ I 383 | , show ∷ I 384 | , seriesIndex ∷ I 385 | , hoverLink ∷ I 386 | , padding ∷ I 387 | , color ∷ I 388 | , textStyle ∷ I 389 | , formatter ∷ I)))) 390 | 391 | type PiecewiseVisualMapI = 392 | PositionMixin 393 | (ZMixin 394 | (BorderAndBackgroundMixin 395 | (MinMaxMixin 396 | ( splitNumber ∷ I 397 | , pieces ∷ I 398 | , categories ∷ I 399 | , selectedMode ∷ I 400 | , inverse ∷ I 401 | , precision ∷ I 402 | , itemWidth ∷ I 403 | , itemHeight ∷ I 404 | , align ∷ I 405 | , text ∷ I 406 | , textGap ∷ I 407 | , itemGap ∷ I 408 | , itemSymbol ∷ I 409 | , show ∷ I 410 | , dimension ∷ I 411 | , seriesIndex ∷ I 412 | , hoverLink ∷ I 413 | , outOfRange ∷ I 414 | , inRange ∷ I 415 | , controller ∷ I 416 | , orient ∷ I 417 | , padding ∷ I 418 | , color ∷ I 419 | , textStyle ∷ I 420 | , formatter ∷ I)))) 421 | 422 | type InOutRangeI = 423 | ( color ∷ I 424 | , symbol ∷ I 425 | , symbolSize ∷ I 426 | , colorAlpha ∷ I 427 | , opacity ∷ I 428 | , colorSaturation ∷ I 429 | , colorHue ∷ I 430 | , colorLightness ∷ I) 431 | 432 | type ControllerI = 433 | ( inRange ∷ I 434 | , outOfRange ∷ I) 435 | 436 | type ToolboxI = 437 | PositionMixin 438 | (ZMixin 439 | (SizeMixin 440 | ( feature ∷ I 441 | , show ∷ I 442 | , orient ∷ I 443 | , itemSize ∷ I 444 | , itemGap ∷ I 445 | , showTitle ∷ I 446 | , iconStyle ∷ I))) 447 | 448 | type IconStyleI = NormalAndEmphasis IconStyleInnerI 449 | 450 | type IconStyleInnerI = 451 | ShadowMixin 452 | ( color ∷ I 453 | , borderColor ∷ I 454 | , borderWidth ∷ I 455 | , borderType ∷ I 456 | , opacity ∷ I) 457 | 458 | type FeatureI = 459 | ( brush ∷ I 460 | , saveAsImage ∷ I 461 | , restore ∷ I 462 | , dataView ∷ I 463 | , dataZoom ∷ I 464 | , magicType ∷ I) 465 | 466 | type DataZoomFeatureI = 467 | ( show ∷ I 468 | , dzfTitle ∷ I 469 | , dzfIcon ∷ I 470 | , iconStyle ∷ I 471 | , xAxisIndex ∷ I 472 | , yAxisIndex ∷ I) 473 | 474 | type DZFI = 475 | ( zoom ∷ I 476 | , back ∷ I) 477 | 478 | type SaveAsImageI = 479 | ( imageType ∷ I 480 | , name ∷ I 481 | , backgroundColor ∷ I 482 | , excludeComponents ∷ I -- ??? 483 | , show ∷ I 484 | , title ∷ I 485 | , icon ∷ I 486 | , iconStyle ∷ I 487 | , pixelRatio ∷ I) 488 | 489 | type RestoreI = 490 | ( show ∷ I 491 | , title ∷ I 492 | , readOnly ∷ I 493 | , optionToContent ∷ I 494 | , contentToOption ∷ I 495 | , lang ∷ I 496 | , backgroundColor ∷ I 497 | , textareaColor ∷ I 498 | , textareaBorderColor ∷ I 499 | , textColor ∷ I 500 | , buttonColor ∷ I 501 | , buttonTextColor ∷ I 502 | , icon ∷ I 503 | , iconStyle ∷ I) 504 | 505 | type DataViewI = 506 | ( show ∷ I 507 | , title ∷ I 508 | , icon ∷ I 509 | , iconStyle ∷ I 510 | , readOnly ∷ I) 511 | 512 | type MagicTypeI = 513 | ( show ∷ I 514 | , mtTitle ∷ I 515 | , mtIcon ∷ I 516 | , mtOption ∷ I 517 | , mtSeriesIndex ∷ I 518 | , magics ∷ I ) 519 | 520 | type MTFieldI = 521 | ( line ∷ I 522 | , bar ∷ I 523 | , stack ∷ I 524 | , tiled ∷ I) 525 | 526 | type BrushFeatureI = 527 | ( brushType ∷ I 528 | , bfIcon ∷ I 529 | , bfTitle ∷ I) 530 | 531 | type BFFieldI = 532 | ( rect ∷ I 533 | , polygon ∷ I 534 | , lineX ∷ I 535 | , lineY ∷ I 536 | , keep ∷ I 537 | , clear ∷ I) 538 | 539 | 540 | type MagicsI = 541 | ( magic ∷ I ) 542 | 543 | type BrushI = 544 | ( brushToolbox ∷ I 545 | , xAxisIndex ∷ I 546 | , brushLink ∷ I 547 | , seriesIndex ∷ I 548 | , geoIndex ∷ I 549 | , yAxisIndex ∷ I 550 | , brushType ∷ I 551 | , brushMode ∷ I 552 | , transformable ∷ I 553 | , brushStyle ∷ I 554 | , throttleType ∷ I 555 | , throttleDelay ∷ I 556 | , removeOnClick ∷ I 557 | , inBrush ∷ I 558 | , outOfBrush ∷ I) 559 | 560 | type BrushToolboxI = 561 | ( tool ∷ I ) 562 | 563 | type GridsI = 564 | ( grid ∷ I ) 565 | 566 | type GridI = 567 | PositionMixin 568 | (ZMixin 569 | (SizeMixin 570 | (ShadowMixin 571 | (BorderAndBackgroundMixin 572 | ( show ∷ I 573 | , textStyle ∷ I 574 | , containLabel ∷ I))))) 575 | 576 | -- | There is no common serie thing, but special cases for 577 | -- | every kind of series. 578 | type SeriesI = 579 | ( pie ∷ I 580 | , line ∷ I 581 | , bar ∷ I 582 | , scatter ∷ I 583 | , effectScatter ∷ I 584 | , radarSeries ∷ I 585 | , treeMap ∷ I 586 | , boxPlot ∷ I 587 | , candlestick ∷ I 588 | , heatMap ∷ I 589 | , map ∷ I 590 | , parallelSeries ∷ I 591 | , lines ∷ I 592 | , graph ∷ I 593 | , sankey ∷ I 594 | , funnel ∷ I 595 | , gauge ∷ I 596 | , missing ∷ I) 597 | 598 | -- | xAxis and yAxis has different position type 599 | type AxisI i = 600 | ZMixin 601 | (NameStyleMixin 602 | (MinMaxMixin 603 | ( axisType ∷ I 604 | , items ∷ I 605 | , axisTick ∷ I 606 | , axisLabel ∷ I 607 | , name ∷ I 608 | , scale ∷ I 609 | , boundaryGap ∷ I 610 | , silent ∷ I 611 | , splitLine ∷ I 612 | , splitArea ∷ I 613 | , axisLine ∷ I 614 | , interval ∷ I 615 | , inverse ∷ I 616 | , splitNumber ∷ I 617 | , minInterval ∷ I 618 | , triggerEvent ∷ I 619 | | i))) 620 | 621 | type SplitAreaI = 622 | ( show ∷ I 623 | , interval ∷ I 624 | , areaStyle ∷ R AreaStyleI) 625 | 626 | type AxisLineI = 627 | ( show ∷ I 628 | , onZero ∷ I 629 | , lineStyle ∷ R LineStyleI) 630 | 631 | type ParallelAxesI = 632 | ( addParallelAxis ∷ I ) 633 | 634 | type YAxesI = 635 | ( addYAxis ∷ I ) 636 | 637 | type XAxesI = 638 | ( addXAxis ∷ I ) 639 | 640 | type ParallelAxisI = 641 | AxisI 642 | (NameStyleMixin 643 | ( dim ∷ I 644 | , parallelIndex ∷ I 645 | , realtime ∷ I)) 646 | 647 | type XAxisI = 648 | AxisI 649 | (NameStyleMixin 650 | ( horizontalPosition ∷ I 651 | , gridIndex ∷ I 652 | , offset ∷ I)) 653 | 654 | type YAxisI = 655 | AxisI 656 | (NameStyleMixin 657 | ( verticalPosition ∷ I 658 | , gridIndex ∷ I 659 | , offset ∷ I)) 660 | 661 | type RadiusAxisI = 662 | AxisI 663 | (NameStyleMixin 664 | ( polarIndex ∷ I)) 665 | 666 | type AngleAxisI = 667 | AxisI 668 | ( polarIndex ∷ I 669 | , startAngle ∷ I 670 | , clockwise ∷ I) 671 | 672 | type SingleAxisI = AxisI (NameStyleMixin ()) 673 | 674 | type LineSeriesI = 675 | ZMixin 676 | (CoordinateSystemMixin 677 | (AnimationMixin 678 | (MarkerMixin 679 | (SymbolMixin 680 | (LegendHoverMixin 681 | ( name ∷ I 682 | , xAxisIndex ∷ I 683 | , yAxisIndex ∷ I 684 | , polarIndex ∷ I 685 | , showSymbol ∷ I 686 | , showAllSymbol ∷ I 687 | , connectNulls ∷ I 688 | , clipOverflow ∷ I 689 | , step ∷ I 690 | , lineStyle ∷ R (NormalAndEmphasis LineStyleI) 691 | , itemStyle ∷ I 692 | , areaStyle ∷ R (NormalAndEmphasis AreaStyleI) 693 | , smooth ∷ I 694 | , smoothMonotone ∷ I 695 | , sampling ∷ I 696 | , items ∷ I 697 | , stack ∷ I 698 | , silent ∷ I 699 | , label ∷ I)))))) 700 | 701 | type BarSeriesI = 702 | ZMixin 703 | (CoordinateSystemMixin 704 | (AnimationMixin 705 | (MarkerMixin 706 | ( name ∷ I 707 | , items ∷ I 708 | , stack ∷ I 709 | , legendHoverLink ∷ I 710 | , xAxisIndex ∷ I 711 | , yAxisIndex ∷ I 712 | , itemStyle ∷ I 713 | , label ∷ I 714 | , barWidth ∷ I 715 | , barMaxWidth ∷ I 716 | , barMinHeight ∷ I 717 | , barGap ∷ I 718 | , barCategoryGap ∷ I)))) 719 | 720 | type PieSeriesI = 721 | ZMixin 722 | (AnimationMixin 723 | (LegendHoverMixin 724 | ( name ∷ I 725 | , center ∷ I 726 | , radius ∷ I 727 | , items ∷ I 728 | , startAngle ∷ I 729 | , selectedMode ∷ I 730 | , selectedOffset ∷ I 731 | , clockwise ∷ I 732 | , minAngle ∷ I 733 | , roseType ∷ I 734 | , avoidLabelOverlap ∷ I 735 | , label ∷ I 736 | , labelLine ∷ I 737 | , itemStyle ∷ I 738 | , silent ∷ I))) 739 | 740 | type BasicScatterSeriesI i = 741 | MarkerMixin 742 | (CoordinateSystemMixin 743 | (ZMixin 744 | (AnimationMixin 745 | (SymbolMixin 746 | (LargeMixin 747 | (LegendHoverMixin 748 | ( name ∷ I 749 | , items ∷ I 750 | , itemStyle ∷ I 751 | , xAxisIndex ∷ I 752 | , yAxisIndex ∷ I 753 | , polarIndex ∷ I 754 | , geoIndex ∷ I 755 | , label ∷ I 756 | , silent ∷ I 757 | , tooltip ∷ I 758 | | i))))))) 759 | 760 | type ScatterI = BasicScatterSeriesI () 761 | 762 | type EffectScatterI = 763 | BasicScatterSeriesI 764 | ( effectType ∷ I 765 | , showEffectOn ∷ I 766 | , rippleEffect ∷ I) 767 | 768 | type RadarSeriesI = 769 | ZMixin 770 | (AnimationMixin 771 | (SymbolMixin 772 | ( name ∷ I 773 | , items ∷ I 774 | , itemStyle ∷ I 775 | , lineStyle ∷ R (NormalAndEmphasis LineStyleI) 776 | , areaStyle ∷ R (NormalAndEmphasis AreaStyleI) 777 | , axisLine ∷ I 778 | , radarIndex ∷ I 779 | , label ∷ I 780 | , silent ∷ I))) 781 | 782 | type TreeMapI = 783 | PositionMixin 784 | (ZMixin 785 | (SizeMixin 786 | (BaseAnimationMixin 787 | ( squareRatio ∷ I 788 | , leafDepth ∷ I 789 | , roam ∷ I 790 | , nodeClick ∷ I 791 | , zoomNodeToRatio ∷ I 792 | , levels ∷ I 793 | , silentTreeMap ∷ I 794 | , visualDimension ∷ I 795 | , colorAlpha ∷ I 796 | , colorSaturation ∷ I 797 | , colorMappingBy ∷ I 798 | , visibleMin ∷ I 799 | , childrenVisibleMin ∷ I 800 | , label ∷ I 801 | , itemStyle ∷ I 802 | , breadcrumb ∷ I 803 | , items ∷ I)))) 804 | 805 | type BoxPlotI = 806 | ZMixin 807 | (CoordinateSystemMixin 808 | (BaseAnimationMixin 809 | (MarkerMixin 810 | (LegendHoverMixin 811 | ( xAxisIndex ∷ I 812 | , yAxisIndex ∷ I 813 | , name ∷ I 814 | , layout ∷ I 815 | , boxWidth ∷ I 816 | , itemStyle ∷ I 817 | , items ∷ I 818 | , silent ∷ I 819 | , tooltip ∷ I))))) 820 | 821 | type CandlestickI = 822 | ZMixin 823 | (CoordinateSystemMixin 824 | (BaseAnimationMixin 825 | (MarkerMixin 826 | (LegendHoverMixin 827 | ( name ∷ I 828 | , items ∷ I 829 | , xAxisIndex ∷ I 830 | , yAxisIndex ∷ I 831 | , layout ∷ I 832 | , itemStyle ∷ I))))) 833 | 834 | type HeatMapI = 835 | ZMixin 836 | (CoordinateSystemMixin 837 | (MarkerMixin 838 | ( name ∷ I 839 | , xAxisIndex ∷ I 840 | , yAxisIndex ∷ I 841 | , calendarIndex :: I 842 | , geoIndex ∷ I 843 | , blurSize ∷ I 844 | , minOpacity ∷ I 845 | , maxOpacity ∷ I 846 | , items ∷ I 847 | , label ∷ I 848 | , itemStyle ∷ I 849 | , silent ∷ I))) 850 | 851 | type MapI = 852 | PositionMixin 853 | (MarkerMixin 854 | (ZMixin 855 | ( name ∷ I 856 | , roam ∷ I 857 | , map ∷ I 858 | , center ∷ I 859 | , zoom ∷ I 860 | , scaleLimit ∷ I 861 | , nameMap ∷ I 862 | , selectedMode ∷ I 863 | , label ∷ I 864 | , itemStyle ∷ I 865 | , layoutCenter ∷ I 866 | , layoutSize ∷ I 867 | , mapValueCalculation ∷ I 868 | , showLegendSymbol ∷ I 869 | , silent ∷ I))) 870 | 871 | type ScaleLimitI = MinMaxMixin () 872 | 873 | type RegionsI = (region ∷ I) 874 | 875 | type RegionI = 876 | ( name ∷ I 877 | , selected ∷ I 878 | , itemStyle ∷ I 879 | , label ∷ I) 880 | 881 | type ParallelSeriesI = 882 | AnimationMixin 883 | (CoordinateSystemMixin 884 | (ZMixin 885 | ( parallelIndex ∷ I 886 | , name ∷ I 887 | , lineStyle ∷ R LineStyleI 888 | , inactiveOpacity ∷ I 889 | , activeOpacity ∷ I 890 | , parallelAxisDefault ∷ I 891 | , realtime ∷ I 892 | , items ∷ I 893 | , silent ∷ I))) 894 | 895 | type LinesI = 896 | ZMixin 897 | (CoordinateSystemMixin 898 | (AnimationMixin 899 | (MarkerMixin 900 | (LargeMixin 901 | ( name ∷ I 902 | , xAxisIndex ∷ I 903 | , yAxisIndex ∷ I 904 | , geoIndex ∷ I 905 | , polyline ∷ I 906 | , effect ∷ I 907 | , lineStyle ∷ R LineStyleI 908 | , label ∷ I 909 | , items ∷ I 910 | , silent ∷ I))))) 911 | 912 | type GraphI = 913 | AnimationMixin 914 | (CoordinateSystemMixin 915 | (ZMixin 916 | (PositionMixin 917 | (SizeMixin 918 | (SymbolMixin 919 | (MarkerMixin 920 | (LegendHoverMixin 921 | ( name ∷ I 922 | , xAxisIndex ∷ I 923 | , yAxisIndex ∷ I 924 | , polarIndex ∷ I 925 | , geoIndex ∷ I 926 | , layout ∷ I 927 | , force ∷ I 928 | , roam ∷ I 929 | , nodeScaleRatio ∷ I 930 | , draggable ∷ I 931 | , focusNodeAdjancency ∷ I 932 | , itemStyle ∷ I 933 | , lineStyle ∷ R (NormalAndEmphasis LineStyleI) 934 | , label ∷ I 935 | , categories ∷ I 936 | , items ∷ I 937 | , nodes ∷ I 938 | , links ∷ I 939 | , edges ∷ I 940 | , edgeLabel ∷ I 941 | , edgeSymbols ∷ I 942 | , edgeSymbolSize ∷ I 943 | , circular ∷ I 944 | , silent ∷ I)))))))) 945 | 946 | 947 | type EdgeLabelI = NormalAndEmphasis EdgeLabelInnerI 948 | 949 | type EdgeLabelInnerI = 950 | ( show ∷ I 951 | , edgeLabelPosition ∷ I 952 | , formatter ∷ I 953 | , textStyle ∷ I ) 954 | 955 | type LinksI = 956 | ( link ∷ I ) 957 | 958 | type LinkI = 959 | ( source ∷ I 960 | , target ∷ I 961 | , label ∷ I 962 | , symbol ∷ I 963 | , lineStyle ∷ R (NormalAndEmphasis LineStyleI) 964 | , value ∷ I 965 | , symbolSize ∷ I) 966 | 967 | type EdgeSymbolsI = 968 | ( edgeSymbol ∷ I ) 969 | 970 | type SankeyI = 971 | AnimationMixin 972 | (ZMixin 973 | (SizeMixin 974 | (PositionMixin 975 | ( nodeWidth ∷ I 976 | , nodeGap ∷ I 977 | , layoutIterations ∷ I 978 | , label ∷ I 979 | , itemStyle ∷ I 980 | , lineStyle ∷ R (NormalAndEmphasis LineStyleI) 981 | , items ∷ I 982 | , nodes ∷ I 983 | , links ∷ I 984 | , edges ∷ I 985 | , silent ∷ I )))) 986 | 987 | type FunnelI = 988 | AnimationMixin 989 | (MarkerMixin 990 | -- positions and sizes are used in examples but aren't documented 991 | (PositionMixin 992 | (SizeMixin 993 | (MinMaxMixin 994 | ( name ∷ I 995 | , label ∷ I 996 | , labelLine ∷ I 997 | , items ∷ I 998 | , itemStyle ∷ I 999 | , minSize ∷ I 1000 | , maxSize ∷ I 1001 | , sort ∷ I 1002 | , gap ∷ I 1003 | , legendHoverLink ∷ I 1004 | , funnelAlign ∷ I 1005 | , silent ∷ I))))) 1006 | 1007 | type GaugeI = 1008 | AnimationMixin 1009 | (ZMixin 1010 | (MarkerMixin 1011 | (MinMaxMixin 1012 | ( name ∷ I 1013 | -- deprecated ?? 1014 | , gaugeRadius ∷ I 1015 | , center ∷ I 1016 | , radius ∷ I 1017 | , startAngle ∷ I 1018 | , endAngle ∷ I 1019 | , clockwise ∷ I 1020 | , splitNumber ∷ I 1021 | , axisLine ∷ I 1022 | , splitLine ∷ I 1023 | , axisTick ∷ I 1024 | , axisLabel ∷ I 1025 | , gaugePointer ∷ I 1026 | , itemStyle ∷ I 1027 | , items ∷ I 1028 | , title ∷ I 1029 | , detail ∷ I 1030 | , silent ∷ I )))) 1031 | 1032 | type GaugePointerI = 1033 | ( show ∷ I 1034 | , length ∷ I 1035 | , width ∷ I) 1036 | 1037 | type ItemI = 1038 | SymbolMixin 1039 | ( name ∷ I 1040 | , treeMapNodeId ∷ I 1041 | , value ∷ I 1042 | , label ∷ I 1043 | , labelLine ∷ I 1044 | , itemStyle ∷ I 1045 | , lineStyle ∷ R LineStyleI 1046 | , areaStyle ∷ R AreaStyleI 1047 | , selected ∷ I 1048 | , icon ∷ I 1049 | , color ∷ I 1050 | , colorAlpha ∷ I 1051 | , colorSaturation ∷ I 1052 | , colorMappingBy ∷ I 1053 | , x ∷ I 1054 | , y ∷ I 1055 | , visualDimension ∷ I 1056 | , visibleMin ∷ I 1057 | , childrenVisibleMin ∷ I 1058 | , coord ∷ I 1059 | , coords ∷ I 1060 | , category ∷ I 1061 | , valueIndex ∷ I 1062 | , valueDim ∷ I 1063 | , markType ∷ I) 1064 | 1065 | type Coords = 1066 | ( coord ∷ I ) 1067 | 1068 | type AxisPointerI = 1069 | AnimationMixin 1070 | ( show ∷ I 1071 | , axis ∷ I 1072 | , pointerType ∷ I 1073 | , axisPointerType ∷ I 1074 | , shadowStyle ∷ I 1075 | , lineStyle ∷ R LineStyleI 1076 | , crossStyle ∷ I) 1077 | 1078 | type ShadowStyleI = 1079 | ShadowMixin 1080 | ( color ∷ I 1081 | , opacity ∷ I) 1082 | 1083 | type LineStylePairI = NormalAndEmphasis LineStyleI 1084 | 1085 | type LineStyleI = 1086 | ShadowMixin 1087 | ( lineType ∷ I 1088 | , width ∷ I 1089 | , color ∷ I 1090 | , opacity ∷ I 1091 | , curveness ∷ I) 1092 | 1093 | type SplitLineI = 1094 | ( show ∷ I 1095 | , lineStyle ∷ R LineStyleI 1096 | , interval ∷ I 1097 | , length ∷ I) 1098 | 1099 | type LabelI = NormalAndEmphasis LabelInnerI 1100 | 1101 | type LabelInnerI = 1102 | ( show ∷ I 1103 | , textStyle ∷ I 1104 | , position ∷ I 1105 | , formatter ∷ I 1106 | , color ∷ I) 1107 | 1108 | type ItemsI = 1109 | ( item ∷ I ) 1110 | 1111 | type ItemStyleI = NormalAndEmphasis IStyleI 1112 | 1113 | type IStyleI = 1114 | ShadowMixin 1115 | ( barBorderWidth ∷ I 1116 | , opacity ∷ I 1117 | , borderWidth ∷ I 1118 | , borderColor ∷ I 1119 | , color ∷ I) 1120 | 1121 | type TextStyleI = 1122 | ( color ∷ I 1123 | , fontWeight ∷ I 1124 | , fontSize ∷ I 1125 | , fontStyle ∷ I 1126 | , fontFamily ∷ I) 1127 | 1128 | type AreaStylePairI = NormalAndEmphasis AreaStyleI 1129 | 1130 | type AreaStyleI = 1131 | ShadowMixin 1132 | ( color ∷ I 1133 | , opacity ∷ I) 1134 | 1135 | type AxisTickI = 1136 | ( show ∷ I 1137 | , length ∷ I 1138 | , inside ∷ I 1139 | , interval ∷ I 1140 | , alignWithLabel ∷ I 1141 | , lineStyle ∷ R LineStyleI 1142 | , splitNumber ∷ I) 1143 | 1144 | type AxisLabelI = 1145 | ( show ∷ I 1146 | , formatter ∷ I 1147 | , interval ∷ I 1148 | , inside ∷ I 1149 | , margin ∷ I 1150 | , rotate ∷ I 1151 | , textStyle ∷ I) 1152 | 1153 | type DetailI = 1154 | ( textStyle ∷ I 1155 | , formatter ∷ I 1156 | , offsetCenter ∷ I 1157 | , show ∷ I) 1158 | 1159 | type LabelLineI = NormalAndEmphasis LabelLineInnerI 1160 | 1161 | type LabelLineInnerI = 1162 | ( show ∷ I ) 1163 | 1164 | type ValuesI = 1165 | ( addValue ∷ I ) 1166 | 1167 | type NamesI = 1168 | ( addName ∷ I ) 1169 | 1170 | type MarkPointI = 1171 | AnimationMixin 1172 | (SymbolMixin 1173 | ( items ∷ I 1174 | , label ∷ I 1175 | , itemStyle ∷ I 1176 | , silent ∷ I)) 1177 | 1178 | type MarkLineI = 1179 | AnimationMixin 1180 | (SymbolMixin 1181 | ( precision ∷ I 1182 | , label ∷ I 1183 | , silent ∷ I 1184 | , lineStyle ∷ R (NormalAndEmphasis LineStyleI) 1185 | , markItems ∷ I)) 1186 | 1187 | type MarkAreaI = 1188 | AnimationMixin 1189 | ( label ∷ I 1190 | , itemStyle ∷ I 1191 | , markItems ∷ I) 1192 | 1193 | type RippleEffectI = 1194 | ( period ∷ I 1195 | , scale ∷ I 1196 | , brushType ∷ I) 1197 | 1198 | type LevelsI = (level ∷ I) 1199 | 1200 | type LevelI = 1201 | ( visualDimension ∷ I 1202 | , color ∷ I 1203 | , colorAlpha ∷ I 1204 | , colorSaturation ∷ I 1205 | , colorMappingBy ∷ I 1206 | , visibleMin ∷ I 1207 | , childrenVisibleMin ∷ I 1208 | , label ∷ I 1209 | , itemStyle ∷ I) 1210 | 1211 | type EffectI = 1212 | ( show ∷ I 1213 | , period ∷ I 1214 | , constantSpeed ∷ I 1215 | , symbol ∷ I 1216 | , symbolSize ∷ I 1217 | , color ∷ I 1218 | , trailLength ∷ I 1219 | , loop ∷ I) 1220 | 1221 | type ForceI = 1222 | ( initLayout ∷ I 1223 | , repulsion ∷ I 1224 | , gravity ∷ I 1225 | , edgeLength ∷ I 1226 | , layoutAnimation ∷ I) 1227 | 1228 | type CategoriesI = (category ∷ I) 1229 | 1230 | type CategoryI = 1231 | SymbolMixin 1232 | ( name ∷ I 1233 | , itemStyle ∷ I 1234 | , label ∷ I) 1235 | 1236 | type CircularI = 1237 | ( rotateLabel ∷ I) 1238 | 1239 | type PointI = 1240 | ( x ∷ I 1241 | , y ∷ I 1242 | ) 1243 | 1244 | type DimensionI = 1245 | ( pixels ∷ I 1246 | , percents ∷ I 1247 | ) 1248 | 1249 | type RadiusI = 1250 | ( start ∷ I 1251 | , end ∷ I 1252 | ) 1253 | --------------------------------------------------------------------------------