 (defn render-pulse
   [pulse results]
   [:div
-    [:h1 {:style (str section-style "margin: 16px; color: rgb(57,67,64);")} (:name pulse)]
+    [:h1 {:style (str section-style "margin: 16px; color: rgb(57,67,64);")} (-> pulse :name h)]
     (apply vector :div (mapv render-pulse-section results))])
 
 ; ported from https://github.com/radkovo/CSSBox/blob/cssbox-4.10/src/main/java/org/fit/cssbox/demo/ImageRenderer.java

(defn render-table-row
  [index row bar-column max-value]
  [:tr {:style (if (odd? index) "color: rgb(189,193,191);" "color: rgb(124,131,129);")}
    [:td {:style bar-td-style} (format-cell (first row))]
    [:td {:style (str bar-td-style "font-weight: 700;")} (format-cell (second row))]
    (if bar-column [:td {:style (str bar-td-style "width: 99%;")}
      [:div {:style (str "background-color: rgb(135, 93, 175); height: 20px; width: " (float (* 100 (/ (bar-column row) max-value))) "%")} "&#160;"]])])


      [:thead
        [:tr
          [:th {:style (str bar-td-style bar-th-style "min-width: 60px;")}
            (-> cols first :display_name upper-case h)]
          [:th {:style (str bar-td-style bar-th-style "min-width: 60px;")}
            (-> cols second :display_name upper-case h)]
          (if bar-column [:th {:style (str bar-td-style bar-th-style "width: 99%;")}])]]
      [:tbody
        (map-indexed #(render-table-row %1 %2 bar-column max-value) rows)]]))

(defn render-bar-chart
  [data]
  [:div
    (render-table data second)])

(defn render-scalar
  [data]
  [:div {:style scalar-style}
    (-> data :rows first first format-cell h)])

(def ^:private sparkline-dot-radius 6)
(def ^:private sparkline-thickness 4)
