Skip to content

Instantly share code, notes, and snippets.

@sooheon
Created February 3, 2016 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sooheon/10a7de8ea0c8c654c2f3 to your computer and use it in GitHub Desktop.
Save sooheon/10a7de8ea0c8c654c2f3 to your computer and use it in GitHub Desktop.
cljsjs use
(ns norgay.app
(:require [reagent.core :as r]
[cljsjs.d3]
[cljsjs.nvd3]))
(defn line-chart
[line-chart-data]
(.addGraph js/nv
(fn []
(let [chart (.. js/nv -models lineChart
(useInteractiveGuideline true)
(color (clj->js ["#900"])))]
(.. chart -xAxis
(axisLabel "Time (ms)")
(tickFormat (.format js/d3 ",r")))
(.. chart -yAxis
(axisLabel "Voltage (v)")
(tickFormat (.format js/d3 ".02f")))
(.. js/d3 (select "#line-chart svg")
(datum (clj->js line-chart-data))
(call chart))))))
(defn init []
(r/render [line-chart] (.getElementById js/document "container")))
(set-env!
:source-paths #{"src/cljs"}
:resource-paths #{"resources"}
:dependencies '[[adzerk/boot-cljs "1.7.48-6" :scope "test"]
[adzerk/boot-cljs-repl "0.2.0" :scope "test"]
[adzerk/boot-reload "0.4.1" :scope "test"]
[pandeiro/boot-http "0.6.3" :scope "test"]
[org.clojure/clojurescript "1.7.122"]
[reagent "0.6.0-alpha" :exclusions [cljsjs/react]]
[cljsjs/react-with-addons "0.14.3-0"]
[cljsjs/d3 "3.5.7-1"]
[cljsjs/nvd3 "1.8.1-0"]
[cljsjs/google-maps "3.18-1"]])
(require
'[adzerk.boot-cljs :refer [cljs]]
'[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]]
'[adzerk.boot-reload :refer [reload]]
'[pandeiro.boot-http :refer [serve]])
(deftask build []
(comp (speak)
(cljs :optimizations :advanced)
))
(deftask run []
(comp (serve)
(watch)
(cljs-repl)
(reload)
(build)))
(deftask production []
(task-options! cljs {:optimizations :advanced})
identity)
(deftask development []
(task-options! cljs {:optimizations :none :source-map true}
reload {:on-jsload 'norgay.app/init})
identity)
(deftask dev
"Simple alias to run application in development mode"
[]
(comp (development)
(run)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment