Skip to content

Instantly share code, notes, and snippets.

@gmp26
Created March 20, 2020 14:00
Show Gist options
  • Save gmp26/649cdb1cb1a49c9ec75f619afcf4a18d to your computer and use it in GitHub Desktop.
Save gmp26/649cdb1cb1a49c9ec75f619afcf4a18d to your computer and use it in GitHub Desktop.
Clone of react-chartjs-2 line example
(ns covid.charts.deaths
(:require
["react-chartjs-2" :refer (Line)]
[reagent.core :as r]
[re-frame.core :as rf]
[covid.subs :as subs]))
(def data {:labels ["January" "February" "March" "April" "May" "June" "July"]
:datasets [{:label "My First dataset"
:fill false
:lineTension 0.1
:backgroundColor "rgba(75,192,192,0.4)"
:borderColor "rgba(75,192,192,1)"
:borderCapStyle "butt"
:borderDash []
:borderDashOffset 0.0
:borderJoinStyle "miter"
:pointBorderColor "rgba(75,192,192,1)"
:pointBackgroundColor "#fff"
:pointBorderWidth 1
:pointHoverRadius 5
:pointHoverBackgroundColor "rgba(75,192,192,1)"
:pointHoverBorderColor "rgba(220,220,220,1)"
:pointHoverBorderWidth 2
:pointRadius 1
:pointHitRadius 10
:data [65 59 80 81 56 55 40]}]})
(defn line-example []
[:div {:style {:width 500}}
[:h2 "Line Example"]
[:> Line {:data data}]])
@gmp26
Copy link
Author

gmp26 commented Mar 20, 2020

Turned out to be simple - no need to convert Line parameters to #js
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment