   []
   (let []
     (log d3)
-    (log nv)
+    ; (log nv)
     (log dimple)
     (log rickshaw)
     (rickshaw-example)))

                       {:x x :y (.cos js/Math (/ x 10))})}]))


(defn nv-example
  []
  (let [svg (-> body
                (.append "svg")
                (.attr "width" 300)
                (.attr "height" 300))]
    (.addGraph nv
               (fn []
                 (let [chart (-> nv.models
                                 (.lineChart)
                                 (.margin #js {:left 100})
                                 (.useInteractiveGuideline true)
                                 (.transitionDuration 350)
                                 (.showLegend true)
                                 (.showYAxis true)
                                 (.showYAxis true))]
                   (-> (.-xAxis chart)
                       (.axisLabel "Time (ms)")
                       (.tickFormat (.format d3 ",r")))
                   (-> (.-yAxis chart)
                       (.axisLabel "Voltage (v)")
                       (.tickFormat (.format d3 ".02f")))
                   ; render
                   (-> svg
                       (.datum (sin-cos))
                       (.call chart))
                   chart)))))


(defn dimple-example
  "Dimple line chart. This requires a .tsv file which can be downloaded from
   https://raw.githubusercontent.com/PMSI-AlignAlytics/dimple/master/data/example_data.tsv"
  []
  ; create a container
  (-> body
      (.append "div")
      (.attr "id" "chartContainer"))
  (let [svg (-> dimple
                (.newSvg "#chartContainer" 590 400))]
    (.tsv d3 "/data/example_data.tsv"
      (fn [d]
        (let [Chart (.-chart dimple)
              data (.filterData dimple d "Owner" #js ["Aperture" "Black Mesa"])
              myChart (Chart. svg data)
              x (.addCategoryAxis myChart "x" "Month")]
          (.addOrderRule x "Date")
          ; (.setBounds myChart 60 30 505 305)
          (.addMeasureAxis myChart "y" "Unit Sales")
          (.addSeries myChart nil (-> js/dimple (.-plot) (.-line)))
          (.draw myChart))))))


(defn influxdb-stream

(enable-console-print!)

(defonce d3 js/d3)
; (defonce nv js/nv)
(defonce dimple js/dimple)
(defonce rickshaw js/Rickshaw)
(defonce body (-> js/d3 (.select "body")))
