{I" class:ETI"BundledAsset;FI"logical_path;TI"prosperity/graph.js.js;FI" pathname;TI"_/Users/simon/Documents/rainforest/prosperity/app/assets/javascripts/prosperity/graph.js.js;FI"content_type;TI"application/javascript;TI" mtime;Tl+"¦RI" length;Tiß I" digest;TI"%f7495fae6f916d4bd75f7a453922ad4b;FI" source;TI"ß // Generated by CoffeeScript 1.6.2 (function() { var Graph; Graph = (function() { function Graph(option) { this.url = option.url; this.el = option.el; this.$el = $(option.el); } Graph.prototype.render = function() { var chart, getSeries, highchartsOptions, _this = this; highchartsOptions = { chart: { type: 'line', renderTo: this.el }, tooltip: { crosshairs: [true, true] }, series: [], xAxis: { type: 'datetime', dateTimeLabelFormats: { day: '%e of %b' } }, yAxis: [{}, {}, {}], title: { text: "Loading..." } }; chart = new Highcharts.Chart(highchartsOptions); getSeries = function(url, axisIndex) { return $.get(url, function(json) { var axisSettings, serie; serie = { data: json.data, name: json.key, yAxis: axisIndex, pointStart: Date.parse(json.start_time), pointInterval: json.period_milliseconds }; axisSettings = { title: { text: json.key }, min: Math.min.apply(Math, json.data), max: Math.max.apply(Math, json.data) }; if (json.key === 'change') { axisSettings = $.extend(axisSettings, { min: 0, max: Math.max.apply(Math, json.data), labels: { formatter: function() { return this.value + '%'; } }, opposite: true }); serie = $.extend(serie, { tooltip: { valueDecimals: 2, valueSuffix: '%' } }); } chart.yAxis[axisIndex].update(axisSettings); return chart.addSeries(serie); }); }; $.getJSON(this.url, function(json) { var extractor, index, _i, _len, _ref, _results; chart.setTitle({ text: json.title }); _ref = json.extractors; _results = []; for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) { extractor = _ref[index]; _results.push(getSeries(extractor.url, index)); } return _results; }); return this; }; return Graph; })(); this.Prosperity.Graph = Graph; }).call(this); ;TI"required_assets_digest;TI"%f3c37f6d68d8b2a52940e5607d3287a1;FI" _version;TI"%01dc9d4cb5b0ece13ed47cc1cabfeb41;F