           (d/p {:class "text-muted text-center"
                 :style {:display (if (:result result) "none" "block")}}
             "Please add items to the query grid.")
-          (d/div {:id (vc-by-ad-result-chart-id query-idx)
+          (d/div {:id (vc-by-ad-and-sex-result-chart-id query-idx)
                   :style {:height (if (:result result) "250px" "0")}}))))))
 
 ;; ---- Query -----------------------------------------------------------------


;; ---- Visit Count By Age Decade --------------------------------------------

(defn visit-count-by-age-decade [result]
  (->> (:visit-count-by-age-decade result)
       (map (fn [[age-decade count]]
              {"Age Decade" age-decade "Visits" count}))))

(defn draw-vc-by-ad-result [id result ticks]
  (let [data (visit-count-by-age-decade result)
        svg (.newSvg js/dimple (str "#" id) "100%" "100%")
        chart (new js/dimple.chart svg (clj->js data))]
    (.setMargins chart 60 10 50 40)
    (.addOrderRule (.addCategoryAxis chart "x" "Age Decade") "Age Decade")
    (let [axis (.addMeasureAxis chart "y" "Visits")]
      (set! (.-tickFormat axis) "d")
      (set! (.-ticks axis) ticks))
    (.addSeries chart nil (.-bar (.-plot js/dimple)))
    (.draw chart)))

;; ---- Queries ---------------------------------------------------------------

                {:opts (assoc opts :query-idx idx :collapsed collapsed)})
      (om/build visit-count-by-study-event-result (:vc-by-se-result query)
                {:opts (assoc opts :query-idx idx :collapsed collapsed)})
      (om/build visit-count-by-age-decade-result (:vc-by-ad-and-sex-result query)
                {:opts (assoc opts :query-idx idx :collapsed collapsed)}))))

;; ---- Workbook --------------------------------------------------------------
