     (javax.imageio.ImageIO/write image "png" os)
     (.toByteArray os)))
 
-(defn render-card-sparkline
-  [card {:keys [rows cols] :as data} render-img]
+(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)

              [: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)]]))

(defn detect-pulse-card-type
  [card data]

        ymax (apply max ys)
        yrange (- ymax ymin)
        ys' (map #(/ (- % ymin) yrange) ys)]
    (render-html-to-png
      [:div {:style (str font-style "color: " color-grey-2 ";") }
        [:div {:style "display: inline-block; position: relative; margin-left: 40px;" }
          [:div {:style "position: relative;"}
            [:div {:style "position: absolute; height: 100%; text-align: right; background-color: red;"}
              [:div {:style "position: absolute; right: 0;"} (format-number-short ymax)]
              [:div {:style "position: absolute; top: 150px; right: 0;"} (format-number-short ymin)]]
            [:img {:style "display: block; left: 20px;" :src (render-img-data-uri (render-sparkline-to-png xs' ys' 275 150))}]
          ]
          [:div
            [:div {:style (str "height: 15px; margin-left: 10px; margin-right: 10px; border: 4px solid " color-grey-1 "; border-top: none; border-bottom: none;")} "&#160;"]
