Package

purescript-gomtang-basic

Repository
justinwoo/purescript-gomtang-basic
License
MIT
Uploaded by
justinwoo
Published on
2018-05-27T21:21:34Z

Another wrapper for ECharts using Union to take records of subsets of allowed fields. Based off of the ideas in React-Basic.

Named for the Korean soup "Gomtang" and the Union-based approach "-basic".

More advanced uses of ECharts can be accomplished with PureScript-ECharts.

Example

main = do
  main_
     <- getElementById (ElementId "main")
    <<< htmlDocumentToNonElementParentNode
    =<< document
    =<< window
  case main_ of
    Nothing ->
      log "could not find 'main' element"
    Just ele -> do
      chart <- makeChart ele
      setOption option chart
      log "started"
  where
    option =
      { title
      , xAxis
      , yAxis
      , series
      }
    title = makeTitle { text: "Bar Example" }
    xAxis = makeXAxis
      { data:
          [ "shirt"
          , "cardigan"
          , "chiffon"
          , "pants"
          , "heels"
          , "socks"
          ]
      }
    yAxis = makeYAxis {}
    series = [ seriesOption ]
    seriesOption = makeBarSeries
      { name: "sales"
      , data: [5.0, 20.0, 36.0, 10.0, 10.0, 20.0]
      }

Looks like this: