 
 (defonce query-window-secs (atom (* 3600 24)))
 
-(def dashboard-state (atom {:series []  :text ""}))
+(def dashboard-state (atom {:series [] :text ""}))
+
+(def window-width (atom 1024))
 
 (defn <<< [f & args]
   (let [c (chan)]

              (watch [:response series-name])
              (cb data))))

(defn tsplot-fetch-and-draw [ canvas series-name ]
  (let [ ctx (.getContext canvas "2d")]
    (go
      (tsplot/draw ctx 1024 180 [])
      (tsplot/draw ctx 1024 180 (<! (<<< fetch-series-data
                                         series-name
                                         @query-window-secs))))))

(defn series-tsplot [ series ]
  (let [ series-state (atom { :series-name (:name series)} ) ]
    (reagent/create-class
     {:display-name (str "series-tsplot-" (:name series))
      :component-did-update
      (fn [ this ]
        (watch :component-did-update)
        (tsplot-fetch-and-draw (reagent/dom-node this) (:name series)))
      
      :component-did-mount
      (fn [ this ]
        (watch :component-did-mount)
        (tsplot-fetch-and-draw (reagent/dom-node this) (:name series)))

      :reagent-render
      (fn []
        @query-window-secs
        @series-state
        [:canvas { :width 1024 :height 180}])})))

(defn series-pane [ series ]
  (watch :render-series-pane)
  [:div.series-pane
   [:div.series-pane-header
    [:span.series-name (:name series)]]
   [series-tsplot series]])

(defn series-list [ ]
  [:div


(defn end-edit [ text state ]
  (let [ qws (js/parseInt text) ]
    (reset! query-window-secs qws)))

(defn input-field [ on-enter ]
