Added percentages to labels

This commit is contained in:
Simon Brooke 2024-07-10 09:26:56 +01:00
parent 72038b34b4
commit b75d7f8839
2 changed files with 3 additions and 3 deletions

View file

@ -103,7 +103,7 @@
:colour "silver" :colour "silver"
:quantity 564243} :quantity 564243}
{:id "reform" {:id "reform"
:label "Reform UK Ltd." :label "Reform UK"
:colour "cyan" :colour "cyan"
:quantity 4091549} :quantity 4091549}
{:id "greenew" {:id "greenew"

View file

@ -36,7 +36,7 @@
["M" (:x start) (:y start) "A" radius radius 0 large-arc? sweep ["M" (:x start) (:y start) "A" radius radius 0 large-arc? sweep
(:x end) (:y end)]))) (:x end) (:y end)])))
(def ^:dynamic *minor-segment-threshold* 0.07) (def ^:dynamic *minor-segment-threshold* 0.08)
(defn- minor-segment? [datum] (defn- minor-segment? [datum]
(< (- (:right datum) (:left datum)) *minor-segment-threshold*)) (< (- (:right datum) (:left datum)) *minor-segment-threshold*))
@ -97,7 +97,7 @@
:font-weight "bold" :font-weight "bold"
:font-size (str (font-size thickness))}} :font-size (str (font-size thickness))}}
[:textPath {:xlink:href (str "#" tp-id) [:textPath {:xlink:href (str "#" tp-id)
:startOffset "2%"} [:tspan (:label datum)]]]])) :startOffset "2%"} [:tspan (format "%s: %.2f%%" (:label datum) (* 100 (:proportion datum)))]]]]))
;; <text ;; <text
;; xml:space="preserve" ;; xml:space="preserve"