                (.removeChild n (.-lastChild n))))
          (let [Chart        (.-chart dimple)
                svg          (.newSvg dimple "#chart" 500 450)
-               measurements (apply concat (vals (select-keys mock-data (:selected cursor)))) 
-               dimple-chart (Chart. svg (clj->js measurements))]
-          (.setBounds dimple-chart 60 30 400 300) 
-          (.addCategoryAxis dimple-chart "x" "month")
-          (.addMeasureAxis dimple-chart "y" "reading")
-          (.addSeries dimple-chart "device_id" js/dimple.plot.line)
+               measurements (apply concat (vals (select-keys mock-data (merge (:left (:selected cursor)) (:right (:selected cursor))))))
+               l-axis-label (str (into [] (:left (:selected cursor))))
+               r-axis-label (str (into [] (:right (:selected cursor))))
+               dimple-chart (Chart. svg (clj->js measurements))
+               x            (.addCategoryAxis dimple-chart "x" "month")
+               y1           (.addMeasureAxis dimple-chart "y" "reading")
+               y2           (.addMeasureAxis dimple-chart "y" "reading")]
+          (.setBounds dimple-chart 60 30 300 300)
+          (.addSeries dimple-chart "device_id" js/dimple.plot.line (clj->js [x y1]))
+          (.addSeries dimple-chart "device_id" js/dimple.plot.line (clj->js [x y2]))
           (.addLegend dimple-chart 60 10 300 20 "right")
           (.draw dimple-chart))))))
 

;;;;;;;;;; Application state ;;;;;;;;;;;;;;;;;

(def chart-state
  (atom {:selected #{}
         :property "rad003"
         :devices [{:hecuba/name "01"
                    :name "External temperature"}


;;;;;;;;;;; Data ;;;;;;;;;;;

(def mock-data {"01"     [{"device_id" "01" "device_name" "External temperature" "month" "01/01/2011" "reading" 0.8}
                          {"device_id" "01" "device_name" "External temperature" "month" "01/02/2011" "reading" 0.9}
                          {"device_id" "01" "device_name" "External temperature" "month" "01/03/2011" "reading" 0.8}
                          {"device_id" "01" "device_name" "External temperature" "month" "01/04/2011" "reading" 0.75}
                          {"device_id" "01" "device_name" "External temperature" "month" "01/05/2011" "reading" 0.65}
                          {"device_id" "01" "device_name" "External temperature" "month" "01/06/2011" "reading" 0.50}
                          {"device_id" "01" "device_name" "External temperature" "month" "01/07/2011" "reading" 0.55}
                          {"device_id" "01" "device_name" "External temperature" "month" "01/08/2011" "reading" 0.6}
                          {"device_id" "01" "device_name" "External temperature" "month" "01/09/2011" "reading" 0.66}
                          {"device_id" "01" "device_name" "External temperature" "month" "01/10/2011" "reading" 0.68}
                          {"device_id" "01" "device_name" "External temperature" "month" "01/11/2011" "reading" 0.71}
                          {"device_id" "01" "device_name" "External temperature" "month" "01/12/2011" "reading" 0.9}]
                "02"     [{"device_id" "02" "device_name" "External humidity" "month" "01/01/2011" "reading" 6}
                          {"device_id" "02" "device_name" "External humidity" "month" "01/02/2011" "reading" 10}
                          {"device_id" "02" "device_name" "External humidity" "month" "01/03/2011" "reading" 12}
                          {"device_id" "02" "device_name" "External humidity" "month" "01/04/2011" "reading" 15}
                          {"device_id" "02" "device_name" "External humidity" "month" "01/05/2011" "reading" 18}
                          {"device_id" "02" "device_name" "External humidity" "month" "01/06/2011" "reading" 20}
                          {"device_id" "02" "device_name" "External humidity" "month" "01/07/2011" "reading" 25}
                          {"device_id" "02" "device_name" "External humidity" "month" "01/08/2011" "reading" 31}
                          {"device_id" "02" "device_name" "External humidity" "month" "01/09/2011" "reading" 20}
                          {"device_id" "02" "device_name" "External humidity" "month" "01/10/2011" "reading" 17}
                          {"device_id" "02" "device_name" "External humidity" "month" "01/11/2011" "reading" 12}
                          {"device_id" "02" "device_name" "External humidity" "month" "01/12/2011" "reading" 9}]})

;;;;;;;;; Utils ;;;;;;;;;;;;;;;;;;;;;;

