[:text
{:text-path {:xlink:href (str "#" name)}}]
--
You received this message because you are subscribed to the Google Groups "C2-cljs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to c2-cljs+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
[:svg {:width (* 2 radius) :height (* 2 radius)}
[:g {:transform (str "translate(" radius "," radius ")")}
(unify slices
(fn [{name :name, bites :bites
{:keys [x dx y dy]} :partition}]
[:g.slice
[:path {:title name
:d (arc :inner-radius (sqrt y)
:outer-radius (sqrt (+ y dy))
:start-angle x
:end-angle (+ x dx))
:fill (color-scale name)}]
;;Make a label.
;;SVG doesn't support radial coordinates, so this is a bit ugly...
(let [label-angle (+ x (/ dx 2))]
[:text {:x (* 0.8 radius (cos label-angle))
:y (* 0.8 radius (sin label-angle))
:text-anchor (condp > (mod label-angle Tau)
(* Tau 0.25) "start"
(* Tau 0.75) "end"
Tau "start")
:style (str "fill: white;"
"font-size: 1.1em;"
"font-family: sans-serif;")
:textPath {:xlink:href (str "#" name)}}
(str name)])]))]]
--
You received this message because you are subscribed to a topic in the Google Groups "C2-cljs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/c2-cljs/aA1UkUugWZE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to c2-cljs+u...@googlegroups.com.
[:svg {:width (* 2 radius) :height (* 2 radius)}
[:g {:transform (str "translate(" radius "," radius ")")}
(unify slices
(fn [{name :name, bites :bites
{:keys [x dx y dy]} :partition}]
[:g.slice
[:path {:title name
:id name
:d (arc :inner-radius (sqrt y)
:outer-radius (sqrt (+ y dy))
:start-angle x
:end-angle (+ x dx))
:fill (color-scale name)}]
;;Make a label.
;;SVG doesn't support radial coordinates, so this is a bit ugly...
(let [label-angle (+ x (/ dx 2))]
[:text {:x (* 0.8 radius (cos label-angle))
:y (* 0.8 radius (sin label-angle))
:text-anchor (condp > (mod label-angle Tau)
(* Tau 0.25) "start"
(* Tau 0.75) "end"
Tau "start")
:style (str "fill: white;"
"font-size: 30;"
"font-family: sans-serif;"
"letter-spacing: 2;")}
[:textPath {:xlink:href (str "#" name)
:startOffset "25%"}
[:tspan {:dy 40}
(str name)]]])]))]]
--
You received this message because you are subscribed to the Google Groups "C2-cljs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to c2-cljs+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.