Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #29 from cryogenian/update-echarts
Browse files Browse the repository at this point in the history
updated echarts
  • Loading branch information
cryogenian authored Oct 9, 2017
2 parents b019916 + 136d51c commit 580fd60
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
5 changes: 4 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
"dependencies": {
"purescript-halogen": "^2.2.0",
"purescript-halogen-css": "^6.0.0",
"purescript-echarts": "^7.0.0"
"purescript-echarts": "^8.0.0"
},
"devDependencies": {
"purescript-debug": "^3.0.0",
"purescript-random": "^3.0.0"
},
"resolutions": {
"purescript-aff": "^3.0.0"
}
}
5 changes: 3 additions & 2 deletions example/src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Data.Array ((!!), length, snoc, sort, reverse, head, filter)
import Data.Foldable (for_)
import Data.Maybe (Maybe(..), maybe)
import Data.Tuple.Nested ((/\))
import ECharts.Monad (interpret)
import Halogen as H
import Halogen.Aff (runHalogenAff, awaitBody)
import Halogen.ECharts as EC
Expand Down Expand Up @@ -81,7 +82,7 @@ eval ∷ Query ~> DSL
eval (SetRandomOption ix next) = do
mbopt ← liftEff $ randomInArray options
for_ mbopt \opt →
void $ H.query ix $ H.action $ EC.Reset opt
void $ H.query ix $ H.action $ EC.Reset $ interpret opt
pure next
eval (AddChart next) = do
H.modify (\x → x{arr = snoc x.arr (maybe 0 (add one) $ head $ reverse $ sort x.arr)})
Expand All @@ -92,7 +93,7 @@ eval (RemoveChart ix next) = do
eval (HandleEChartsMessage ix EC.Initialized next) = do
mbopt ← liftEff $ randomInArray options
for_ mbopt \opt →
void $ H.query ix $ H.action $ EC.Set opt
void $ H.query ix $ H.action $ EC.Set $ interpret opt
pure next
eval (HandleEChartsMessage ix (EC.EventRaised evt) next) = do
pure next
Expand Down
14 changes: 7 additions & 7 deletions example/src/Options.purs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import Data.Foldable as F
import ECharts.Commands as E
import ECharts.Types as ET
import ECharts.Types.Phantom as ETP
import ECharts.Monad (DSL)
import ECharts.Monad (DSL')

lineOptions DSL ETP.OptionI
lineOptions DSL' ETP.OptionI
lineOptions = do
E.tooltip E.triggerAxis
E.legend do
Expand Down Expand Up @@ -65,7 +65,7 @@ lineOptions = do
E.items $ map ET.numItem [ 820.0, 932.0, 901.0, 934.0, 1290.0, 1330.0, 1320.0 ]


graphOptions DSL ETP.OptionI
graphOptions DSL' ETP.OptionI
graphOptions = do
E.title $ E.text "Graph"
E.tooltip $ pure unit
Expand Down Expand Up @@ -135,7 +135,7 @@ graphOptions = do
E.targetName "four"


radarOptions DSL ETP.OptionI
radarOptions DSL' ETP.OptionI
radarOptions = do
E.radar do
E.indicators do
Expand Down Expand Up @@ -167,7 +167,7 @@ radarOptions = do
E.name "Actual"
E.values [ 5000.0, 14000.0, 28000.0, 31000.0, 42000.0, 21000.0 ]

kOptions DSL ETP.OptionI
kOptions DSL' ETP.OptionI
kOptions = do
E.xAxis do
E.axisType ET.Category
Expand All @@ -187,7 +187,7 @@ kOptions = do
]


funnelOptions DSL ETP.OptionI
funnelOptions DSL' ETP.OptionI
funnelOptions = do
E.series $ E.funnel do
E.ascending
Expand All @@ -206,7 +206,7 @@ funnelOptions = do
E.value 123.0


options Array (DSL ETP.OptionI)
options Array (DSL' ETP.OptionI)
options =
[ lineOptions
, graphOptions
Expand Down
6 changes: 2 additions & 4 deletions src/Halogen/ECharts.purs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ import Data.Traversable (for)
import Data.Tuple.Nested (type (/\), (/\))
import ECharts.Chart as EC
import ECharts.Event as EE
import ECharts.Monad as EM
import ECharts.Theme as ETheme
import ECharts.Types as ET
import ECharts.Types.Phantom as ETP
import Halogen as H
import Halogen.HTML as HH
import Halogen.HTML.CSS (style)
Expand All @@ -45,8 +43,8 @@ data EChartsQuery a
= Init (Maybe ETheme.Theme) a
| HandleEvent ET.EChartsEvent (H.SubscribeStatus a)
| Dispose a
| Set (EM.DSL ETP.OptionI) a
| Reset (EM.DSL ETP.OptionI) a
| Set ET.Option a
| Reset ET.Option a
| Resize a
| Clear a
| SetDimensions { width Int, height Int } a
Expand Down

0 comments on commit 580fd60

Please sign in to comment.