   (let [data (vega/ensure-facet-keys data)
         spec (-> data
                  vega/dodged-bar
-                 #_(update-in [:marks 0 :from] (constantly nil))
                  (vega/facet data))]
-    (wrap-top-data spec)))
+    (wrap-dims spec)))
 
 (defn line
   [data]

        point-spec (vega/point data)
        facetted-spec (vega/facet (update-in point-spec [:marks 0 :from] (constantly nil))
                                  data)]
    (wrap-top-data facetted-spec)))

(defn stacked-bar
  [data]
  (let [data (vega/ensure-facet-keys data)
        spec (-> data
                 vega/stacked-bar
                 (update-in [:data :transform 0 :groupby]
                            #(concat % [vega/*facet-x* vega/*facet-y*]))
                 (update-in [:marks 0 :from] (constantly nil))
                 (vega/facet data))]
    (wrap-top-data spec)))

(defn bar
  [data]

            [ring.util.codec :refer [url-encode]]))

(def ^:dynamic *current-plot-key* :default)

(defn wrap-dims
  [spec]
  (util/merge-spec vega/top-level spec))

(defn facet-global
  "Facets the data by the *facet-x* fand *facet-y* keys. Scales are
  the same for each subplot."
  [{:keys [scales axes marks legends] [{data :values} & more] :data :as vega-spec}]
  (let [facet-keyed-data (vega/ensure-facet-keys data)]
    (prn facet-keyed-data)
    (wrap-dims (vega/facet (update-in vega-spec [:marks 0 :from :data] (constantly nil))
                           facet-keyed-data))))

(defn plot
  "Plots the given vega-spec on the browser client connected by
