           id))
       (d/p {:class "text-muted"}
         (or (:name form) "loading..."))
-      (d/div {:id (cell-id query-idx col-idx id)
-              :style {:height "200px"}}))))
+      (d/div {:id (cell-id opts id) :style {:height "200px"}}))))
 
 (defn single-item-group-expr [{:keys [id]}]
   {:items [[[:item-group id]]]})
 
-(defcomponent item-group [{:keys [id] :as item-group} owner
-                          {:keys [query-idx col-idx]}]
-  (will-mount [_]
+(defcomponent item-group [{:keys [id] :as item-group} owner opts]
+  (will-mount [_]
+    (when-not (:name item-group)
+      (load-term! owner :lens/find-item-group opts id))
     (execute-query! owner (single-item-group-expr item-group)
-                    [:result-loaded query-idx col-idx id]))
+                    (result-loaded opts id)))
+  (render [_]
+    (d/div
+      (d/div (or (util/add-soft-hyphen (:name item-group)) "loading..."))
+      (d/div {:id (cell-id opts id) :style {:height "200px"}}))))
+
+(defcomponent item [{:keys [id] :as item} owner opts]
+  (will-mount [_]
+    (when-not (if (s/is-numeric? item) (:value-histogram item) (:question item))
+      (load-term! owner :lens/find-item opts id)))
   (did-update [_ _ _]
-    (when-let [result (:result item-group)]
-      (clear-chart (cell-id query-idx col-idx id))
-      (draw-query-result (cell-id query-idx col-idx id) result)))
-  (render [_]
-    (d/div
-      (d/div (util/add-soft-hyphen (:name item-group)))
-      (d/p {:class "text-muted"}
-        (str "Form: " (:name (:parent item-group))))
-      (d/div {:id (cell-id query-idx col-idx id)}))))
-
-(defcomponent item [{:keys [id] :as item} _ _]
-  (will-mount [_]
-    )
-  (will-update [_ _ _]
-    )
-  (did-update [_ _ _]
-    )
+    (when-let [value-histogram (value-hist item)]
+      (clear-chart (cell-id opts id))
+      (draw-item-chart (cell-id opts id) value-histogram)))
   (render [_]
     (d/div
       (d/div

          (str alias " (" id ")")
          id))
      (d/p {:class "text-muted"}
        (:question item))
      (d/div {:id id}))))

(defn query-grid-cell-mouse-leave [state]
  (assoc state :hover false :dropdown-hover false :dropdown-active false))

(defcomponent query-grid-cell
  "A cell in a query grid.

     :dropdown-hover false
     :dropdown-active false})
  (will-mount [_]
    (bus/listen-on owner (result-loaded opts id)
      #(om/update! term :result (select-keys % [:visit-count-by-study-event])))
    (bus/listen-on owner [:term-loaded query-idx col-idx id]
      (fn [new-term] (om/transact! term #(merge-into-term % new-term)))))
  (will-unmount [_]
    (bus/unlisten-all owner))
  (did-update [_ _ _]
    (when-let [result (:result term)]
      (clear-chart (cell-id opts id))
      (draw-query-result (cell-id opts id) result)))
  (render-state [_ {:keys [hover dropdown-hover dropdown-active]}]
    (d/div {:class "query-cell"
            :on-mouse-enter #(om/set-state! owner :hover true)
