Created
June 10, 2018 17:48
-
-
Save maleghast/e2fc6ef83edc20d8b4e8454dd079de41 to your computer and use it in GitHub Desktop.
Example form-3 functions for redefining TreeMap in Recharts
This file contains hidden or 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 treemap-label | |
[] | |
(r/create-class | |
{:reagent-render (fn | |
[] | |
(let [props (r/props this)] | |
[:g | |
[:text | |
{:x (/ (+ (:x props) (:width props)) 2) | |
:y (+ (/ (+ (:y props) (:height props)) 2) 7) | |
:textAnchor "middle" | |
:fill "#FFFFFF" | |
:fontSize 14} | |
(:name props) | |
[:br] | |
(:size props)]]))})) | |
(defn labelled-treemap | |
[order] | |
(r/create-class | |
{:reagent-render (fn | |
[order] | |
[:> js/Recharts.Treemap | |
{:width 550 | |
:height 350 | |
:data (clj->js (prepare-performance-treemap-data order)) | |
:dataKey "size" | |
:nameKey "name" | |
:ratio (/ 4 3) | |
:stroke "#fff" | |
:content [treemap-label]} | |
])})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment