app/assets/javascripts/prosperity/application.js.coffee in prosperity-0.0.1 vs app/assets/javascripts/prosperity/application.js.coffee in prosperity-0.0.2
- old
+ new
@@ -10,33 +10,14 @@
# Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
# about supported directives.
#
#= require jquery
#= require jquery_ujs
-#= require chart
-#= require twitter/bootstrap
+#= require highcharts
#= require_tree .
$ ->
- $("canvas.metric").each (i, el) ->
- ctx = el.getContext("2d")
- points = $(el).data('points')
-
- datasets = []
-
- size = 0
- for key, data of points
- datasets.push
- data: data
- fillColor : "rgba(151,187,205,0)",
- strokeColor : "rgba(0,0,0,1)",
-
-
- size = Math.max(size, data.length)
-
- data =
- labels : (i for i in [0..size])
- datasets: datasets
-
- myNewChart = new Chart(ctx).Line(data)
-
+ $(".metric").each (i, el) ->
+ $el = $(el)
+ url = $el.data('url')
+ graph = new Prosperity.Graph(el: el, url: url).render()