                    [:.row
                     [:.col {:class (if show-dimensions "s9" "s12") :id "parsets" :ref "parsets-div"}]
                     [:.col {:class (if show-dimensions "s3" "hide") :ref "parsets-dims"}
-                     (if (:terms-aggs parsets-cursor)
-                       (for [term (get-agg-terms)]
-                         (let [term-name (name term)]
-                           (build-bar parsets-cursor owner agg-prefix-terms term-name (-> (:sub agg) keys first)))))
+                     (when-not (empty? parsets-data) (map #(build-bar owner (name %)) (get-agg-terms)))
                      ]
                     ]]]
                  ))

    {:order {sort-field "desc"}}
    {}))

(defn- build-parsets-agg
  [terms sub-aggs]
  (reduce (fn [agg-query a-term]
            {:aggs (merge
                    {(keyword a-term)
                     (merge {:terms
                             (merge {:field a-term :size 5}
                                    (sort-sub sub-aggs))}
                            agg-query)}
                    sub-aggs)})
          (build-sub-aggs sub-aggs) terms))

(defn- build-terms-agg [prefix terms sub-aggs]
  (let [terms-aggs (for [term terms]
                     {(str prefix (name term)) (merge {:terms (merge {:field (name term) :size 5}
                                                                     (sort-sub sub-aggs))}
                                                      (build-sub-aggs sub-aggs))})
        terms-aggs (reduce merge terms-aggs)]
    terms-aggs))

(defn- walk-buckets [de-buck bucket prefix steps value-path]
  (map #(de-buck % de-buck prefix (first steps) (rest steps) value-path)

      (.dimensions (clj->js (map name (get-parsets-agg))))
      (.value (fn [d i] (. d -value)))))

(defn highlight [data facets]
  (filter #(every? (fn [[k sel]] (or (empty? sel) (contains? sel (k %)))) facets) data))

