Created
May 28, 2015 08:51
-
-
Save gphilipp/a77d53a4bb68e7345ef5 to your computer and use it in GitHub Desktop.
This file contains 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
(defn dashboard-component-view [cursor owner {:keys [div-id title]}] | |
(reify | |
om/IInitState | |
(init-state [_] | |
(let [width 960 height 500] | |
{:width width :height height | |
:comm (chan) | |
:svg nil | |
})) | |
om/IRender | |
(render [_] | |
(dom/div #js {:id div-id :className "pure-u-1-3 donut"} | |
(dom/h4 nil "Hye") | |
(dom/svg nil))) | |
om/IDidMount | |
(did-mount [_] | |
(.addGraph js/nv | |
(fn [] | |
(let [chart (.. js/nv -models pieChart | |
;(margin #js {:left 100}) | |
;(useInteractiveGuideline true) | |
;(transitionDuration 350) | |
;(showYAxis true) | |
;(showXAxis true) | |
(x (fn [d] (.-label d))) | |
(y (fn [d] (.-value d))) | |
(showLegend false) | |
(tooltips false) | |
(showLabels true) | |
(labelThreshold 0.05) | |
(labelType "key") | |
(donut true) | |
(donutRatio 0.35) | |
(id "donut1") | |
(padAngle .06) | |
(title title))] | |
(let [data (clj->js [{:label "Depuis l'origine" :value 25} | |
{:label "2015" :value 25} | |
{:label "2014" :value 25} | |
{:label "2013" :value 25}])] | |
(.. js/d3 (select (str "#" div-id " svg")) | |
(datum (clj->js data)) | |
(call chart)))))) | |
))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment