Created
May 28, 2015 09:45
-
-
Save gphilipp/b8e3d196e21433b3760a 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 portfolio-perf-view [cursor owner {:keys [div-id title]}] | |
(reify | |
om/IRender | |
(render [_] | |
(dom/div #js {:id div-id} | |
(dom/svg nil))) | |
om/IDidMount | |
(did-mount [_] | |
(.addGraph js/nv | |
(fn [] | |
(let [chart (.. js/nv -models discreteBarChart | |
;(margin #js {:left 100}) | |
;(useInteractiveGuideline true) | |
;(transitionDuration 350) | |
;(showYAxis true) | |
;(showXAxis true) | |
(x (fn [d] (.-label d))) | |
(y (fn [d] (.-value d))) | |
;(showLegend false) | |
;(staggerLabels false) | |
;(tooltips false) | |
;(showLabels true) | |
;(labelThreshold 0.05) | |
;(labelType "key") | |
;(id "donut1") | |
;(padAngle .06) | |
;(transitionDuration 350) | |
;(title title) | |
)] | |
(let [data (clj->js [{:key "foo" | |
:values [{:label "Depots" :value 4000} | |
{:label "Retraits" :value -1000}]}])] | |
(.. 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