Commit 64c62698 authored by Bruno Burke's avatar Bruno Burke 😁

component did update for scaled question

parent 359dadcb
......@@ -103,6 +103,16 @@
:plugins [{:afterDatasetsDraw #(afterDraw % {:mean mean :stdev stdev})}]
(fn [comp]
(let [bars (:bars (reagent/props comp))
freqs (:freqs (reagent/props comp))]
(oset! @chart-instance "data.labels" (clj->js bars))
(oset! @chart-instance ""
(clj->js (mapv
#(get freqs % 0)
(.update @chart-instance)))
(fn []
(when @chart-instance
......@@ -120,7 +130,7 @@
(defn scale [question & {:keys [answers on-change]}]
(let [id (gensym)]
(fn [question & {:keys [answer on-change]}]
(fn [question & {:keys [answers on-change]}]
(let [abstention? (:abstention question)
freqs (frequencies (map :value answers))
stats (freq/stats (dissoc freqs :abstention))
......@@ -142,7 +152,6 @@
(str "s=" (gstring/format "%.1f" (:stdev stats))) [:br]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment