                         (range (/ (range-magnitude y-range) y-interval))))]
         (draw-y-grid-line ctx w (pixel-snap (ty y)) y (= y 0))))))
 
+
+
+(defn draw-x-grid [ ctx w h x-range ]
+  (draw-xlabel ctx (format-xlabel (:min x-range)) 0 h true)
+  (draw-xlabel ctx (format-xlabel (:max x-range)) w h false))
+
 (defn draw-series [ ctx w h data x-range ]
   (with-preserved-ctx ctx
     (set-stroke-style ctx :series-line)

    (set-stroke-style ctx :frame)
    (draw-line ctx [ 0.5 0.5 ] [ 0.5 (- h 0.5) ] )))

(defn draw [ ctx w h data begin-t end-t]
  (draw-series-background ctx w h)
  (let [w (- w y-axis-space tsplot-right-margin)
        h (- h x-axis-space)]

     :min (- (:min range) scaled-delta)}))

(defn draw-xlabel [ ctx text x y left? ]
  (with-preserved-ctx ctx
    (aset ctx "textBaseline" "top")
    (aset ctx "textAlign" (if left? "left" "right"))
    (.fillText ctx text x y)))

(defn draw-ylabel [ ctx text x y ]
  (with-preserved-ctx ctx
    (aset ctx "textBaseline" "middle")
    (aset ctx "textAlign" "right")
    (.fillText ctx text x y)))

(defn translate-fn [ range size ]
  (let [min (:min range)
