               [:div {:style "float: left;"} (format-timestamp xmin (first cols))]
               [:div {:style "float: right;"} (format-timestamp xmax (first cols))]]
           ]]]
-      [:div {:style "margin-top: 20px; margin-left: 30px;"}
-        (render-table card [(last rows) (first rows)] cols render-img [0 1] nil)]]))
+        300)))
+
+(defn render-card-sparkline
+  [card {:keys [rows cols] :as data} render-img]
+  [:div
+    [:img {:style "display: block" :src (render-img (render-sparkline-with-axis-to-png card data))}]
+    [:div {:style "margin-top: 20px; margin-left: 30px;"}
+      (render-table card [(last rows) (first rows)] cols render-img [0 1] nil)]])
 
 (defn detect-pulse-card-type
   [card data]

(defn card-href
  [card]
  (h (str (setting/get :-site-url) "/card/" (:id card) "?clone")))

(defn render-button
  [text href icon render-img]

    (javax.imageio.ImageIO/write image "png" os)
    (.toByteArray os)))

(defn render-sparkline-with-axis-to-png
  [card {:keys [rows cols] :as data}]
  (let [xs (for [row rows :let [x (first row)]] (if (instance? java.util.Date x) (.getTime x) x))
        xmin (apply min xs)
        xmax (apply max xs)
