Last active
December 6, 2018 16:03
-
-
Save girishso/d5545705ea4eee4f0af852f849af1b85 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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