Skip to content

Instantly share code, notes, and snippets.

@edwthomas
edwthomas / charts-reframe.cljs
Created June 8, 2016 00:13
Example of using Chart.js with Clojurescript
(:require [re-frame.core :as re-frame]
[reagent.core :as reagent]
[cljsjs.chartjs])
(defn show-revenue-chart
[]
(let [context (.getContext (.getElementById js/document "rev-chartjs") "2d")
chart-data {:type "bar"
:data {:labels ["2012" "2013" "2014" "2015" "2016"]
:datasets [{:data [5 10 15 20 25]
@edwthomas
edwthomas / chart_reframe.cljs
Created June 7, 2016 20:43
Using CLJS and Re-frame to call third-part JS library (Chartist.js)
(:require [re-frame.core :as re-frame]
[reagent.core :as reagent]
[cljsjs.chartist])
(defn show-chart
[]
(let [chart-data {:labels ["Mar-2012" "Jun-2012" "Nov-2012" "Oct-2013" "Nov-2014"]
:series [[1 1 6 15 25]]}
options {:width "700px"
:height "380px"}]