 (defn setup-bar [bar x y]
   ;; add rect
   (-> bar (.append "rect")
-      (.attr (clj->js {:width   #(x %)
-                       :height  (.rangeBand y)})))
+      (.attr (clj->js {:width x
+                       :height (.rangeBand y)})))
 
   ;; add text
   (-> bar (.append "text")
-      (.attr (clj->js {:x  x
-                       :y  (/ (.rangeBand y) 2)
+      (.attr (clj->js {:x x
+                       :y (/ (.rangeBand y) 2)
                        :dx -6
                        :dy ".35em"
                        :text-anchor "end"}))

      (.on "mouseout" mouseout)))

(defn render* [id data labels]
  (let [x (-> d3 .-scale (.linear)
              (.domain (array 0 (apply max data)))
              (.range (array 0 w)))
        y (-> d3 .-scale (.ordinal)
              (.domain (apply array (range (count data))))
              (.rangeRoundBands (array 0 h) 0.2))
        svg (-> d3 (.select id) (.append "svg")
                (.attr (clj->js {:width  (+ w (m 1) (m 3))
                                 :height (+ h (m 0) (m 2))}))
                (.append "g")
                (.attr (clj->js {:transform (str "translate(" (m 3) "," (m 0) ")")})))
        bar (-> svg (.selectAll "g.bar")
                (.data (clj->js data))
                (.enter) (.append "g")

  (:require [domina :as dom]))

(def d3 (this-as ct (aget ct "d3")))

;; mouse* fns for tooltips - based on http://bl.ocks.org/biovisualize/1016860
(defn mouseover [e]
