Skip to content

Instantly share code, notes, and snippets.

@girishso
Last active December 6, 2018 16:03
Show Gist options
  • Save girishso/d5545705ea4eee4f0af852f849af1b85 to your computer and use it in GitHub Desktop.
Save girishso/d5545705ea4eee4f0af852f849af1b85 to your computer and use it in GitHub Desktop.
view : Model -> Html Msg
view model =
let
renderSvg which =
div [ HA.id "chartContainer", HA.attribute "data-type" which ]
[ svg [ HA.id "bar", HA.width 700, HA.height 500 ] [] ]
in
div []
[ button [ onClick (ShowChart BarChart), disabled (model.chart /= NoChart) ] [ Html.text "Show Bar Chart" ]
, button [ onClick (ShowChart PieChart), disabled (model.chart /= NoChart) ] [ Html.text "Show Pie Chart" ]
, button [ onClick (ShowChart NoChart), disabled (model.chart == NoChart) ] [ Html.text "Hide Chart" ]
, hr [] []
, case model.chart of
BarChart ->
renderSvg "bar"
PieChart ->
renderSvg "pie"
NoChart ->
Html.text ""
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment