                         (.nice))
         y-neg-scale (-> (js/d3.scale.linear)
                         (.domain #js[0 y-max])
-                        (.range #js[(y-scale 0) height])
+                        (.range #js[(y-scale 0) (:height plot-info)])
                         (.nice))
         y-middle (y-scale 0)
         y-tick-values (map js/Math.round

        grid-lines-container (-> svg
                                 (.append "g")
                                 (.attr "class" "grid-line horizontal"))]
    ;; legend
    (let [{:keys [square-size item-width item-height spacing]} legend-dimensions
          left-legend-item (-> svg
                          (.selectAll ".legend")
                          (.data (clj->js left-legend))
                          (.enter)
                          (.append "g")
                          (.attr #js {"class" "legend left"
                                      "transform"
                                      (fn [item i]
                                        (let [tr-x (* i item-width)
                                              tr-y (- (- item-height
                                                         (/ (- item-height square-size)
                                                            2)))]
                                          (gstring/format "translate(%s,%s)" tr-x  tr-y)))}))
          right-legend-item (-> svg
                          (.selectAll ".legend-right")
                          (.data (clj->js right-legend))
                          (.enter)
                          (.append "g")
                          (.attr #js {"class" "legend right"
                                      "transform"
                                      (fn [item i]
                                        (let [tr-x (- width (* (inc i) item-width))
                                              tr-y (- (- item-height
                                                         (/ (- item-height square-size)
                                                            2)))]
                                          (gstring/format "translate(%s,%s)" tr-x  tr-y)))}))]
      ;; left legend
      (-> left-legend-item
          (.append "rect")
          (.attr #js {"width" square-size
                      "height" square-size
                      "class" #(.-class_name %)
                      "transform"
                      (fn [item i]
                        (gstring/format "translate(%s,%s)" 0  (- (+ square-size))))}))
      (-> left-legend-item
          (.append "text")
          (.attr #js {"x" (+ square-size spacing)})
          (.text #(.-text %)))

      ;; right legend
      (-> right-legend-item
          (.append "rect")
          (.attr #js {"width" square-size
                      "height" square-size
                      "class" #(.-class_name %)
                      "transform"
                      (fn [item i]
                        (gstring/format "translate(%s,%s)" 0  (- (+ square-size))))}))
      (-> right-legend-item
          (.append "text")
          (.attr #js {"x" (+ square-size
                             spacing)})
          (.text #(.-text %))))

    ;; y-axis
    (-> svg

        x-scale (-> (js/d3.scale.ordinal)
                    (.domain (clj->js
                              (map :build_num builds)))
                    (.rangeBands #js[0 (:width plot-info)] 0.5))
        svg (-> js/d3
                (.select elem)
                (.html "")
                (.append "svg")
                (.attr "width" (:width svg-info))
                (.attr "height" (:height svg-info))
                (.append "g")
                (.attr "transform" (gstring/format "translate(%s,%s)"
                                                   (:left svg-info)
                                                   (:top svg-info))))
        enter (-> svg
                  (.selectAll "rect")
                  (.data (clj->js builds))
