Reagent component for Chart.js
(defn sales-chart-data []
{:type "line"
:responsive true
:options {:title {:display true
:text "Pepsi vs Coke Sales"}}
:maintainAspectRatio false
:data {:labels ["Jan" "Feb" "Mar" "Apr" "May"
"Jun" "Jul" "Aug" "Sep" "Oct"
"Nov" "Dec"]
:datasets [{:data (repeatedly 12 #(rand-int 500))
:label "Pepsi"
:backgroundColor "#FF0000"}
{:data (repeatedly 12 #(rand-int 500))
:label "Coca-Cola"
:backgroundColor "#00FF00"}]}})
(defn sales-chart []
[chart/chart-component (sales-chart-data)])
See Chart.js docs for more details on the chart options passed to the component.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close