spec/dummy/tmp/cache/assets/test/sprockets/27a59e08207d3ae723f2b2b3d22264c3 in prosperity-0.0.5 vs spec/dummy/tmp/cache/assets/test/sprockets/27a59e08207d3ae723f2b2b3d22264c3 in prosperity-0.0.6
- old
+ new
@@ -1,95 +1,93 @@
{I"
class:ETI"ProcessedAsset; FI"logical_path; TI"prosperity/graph.js; FI"
pathname; TI"c/Users/simon/Documents/rainforest/prosperity/app/assets/javascripts/prosperity/graph.js.coffee; FI"content_type; TI"application/javascript; TI"
-mtime; Tl+`¹åRI"length; Ti-I"digest; TI"%f24556ca2a4cc1f23f99cc6d4eeea8b1; FI"source; TI"-(function() {
- var Graph, updateMetricOptions;
+mtime; Tl+¬[vSI"length; TiqI"digest; TI"%b9a17205ffa8192b322068d18f9c8874; FI"source; TI"q(function() {
+ var Graph, SubGraph, updateMetricOptions,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
- Graph = (function() {
- function Graph(option) {
- this.url = option.url;
- this.el = option.el;
- this.$el = $(option.el);
+ SubGraph = (function() {
+ function SubGraph(options) {
+ this.url = options.url;
}
- Graph.prototype.render = function() {
- var chart, getSeries, highchartsOptions;
- 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);
+ SubGraph.prototype.render = function() {
+ var chartEl, el, getSeries;
+ el = $('<div>', {
+ "class": 'sub-graph'
+ });
+ el.append("<div class='title'>Loading...</div>");
+ chartEl = $('<div>', {
+ "class": 'sub-graph-chart'
+ });
+ el.append(chartEl);
getSeries = (function(_this) {
- return function(url, axisIndex) {
+ return function(url) {
return $.get(url, function(json) {
- var axisSettings, serie;
- axisIndex = Math.min(axisIndex, chart.yAxis.length - 1);
- serie = {
- data: json.data,
- name: json.label,
- yAxis: axisIndex,
- pointStart: Date.parse(json.start_time),
- pointInterval: json.period_milliseconds
+ var chart, chartOptions, data, i, point, redraw, start_time, time, _i, _len, _ref;
+ el.find('.title').html(json.label);
+ chartOptions = {
+ element: chartEl,
+ series: [],
+ xkey: "x",
+ ykeys: [],
+ labels: [],
+ smooth: false
};
- 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
+ chartOptions.postUnits = '%';
+ }
+ chart = new Morris.Line(chartOptions);
+ data = [];
+ start_time = Date.parse(json.start_time);
+ _ref = json.data;
+ for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
+ point = _ref[i];
+ time = start_time + i * json.period_milliseconds;
+ data[i] || (data[i] = {
+ x: time
});
- serie = $.extend(serie, {
- tooltip: {
- valueDecimals: 2,
- valueSuffix: '%'
- }
- });
+ data[i][json.key] = point;
}
- chart.yAxis[axisIndex].update(axisSettings);
- return chart.addSeries(serie);
+ chart.options.ykeys.push(json.key);
+ chart.options.labels.push(json.key);
+ return chart.setData(data.slice(), redraw = true);
});
};
})(this);
- $.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;
- });
+ getSeries(this.url);
+ return el;
+ };
+
+ return SubGraph;
+
+ })();
+
+ Graph = (function() {
+ function Graph(options) {
+ this.render = __bind(this.render, this);
+ this.url = options.url;
+ this.el = options.el;
+ this.$el = $(options.el);
+ }
+
+ Graph.prototype.render = function() {
+ $.getJSON(this.url, (function(_this) {
+ return function(json) {
+ var el, extractor, index, subgraph, _i, _len, _ref, _results;
+ _ref = json.extractors;
+ _results = [];
+ for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) {
+ extractor = _ref[index];
+ subgraph = new SubGraph({
+ url: extractor.url
+ });
+ el = subgraph.render();
+ _results.push(_this.$el.append(el));
+ }
+ return _results;
+ };
+ })(this));
return this;
};
return Graph;
@@ -132,7 +130,7 @@
return updateMetricOptions(el);
});
});
}).call(this);
-; TI"dependency_digest; TI"%b05c3c764431aabd86e09187bef725e7; FI"required_paths; T[I"c/Users/simon/Documents/rainforest/prosperity/app/assets/javascripts/prosperity/graph.js.coffee; FI"dependency_paths; T[{I" path; TI"c/Users/simon/Documents/rainforest/prosperity/app/assets/javascripts/prosperity/graph.js.coffee; FI"
-mtime; TI"2014-01-26T17:41:52-08:00; TI"digest; TI"%22fb2ca2bf3bfdff555f582e3ead8994; FI"
_version; TI"%2b66aa67c90052d553e0328c249bc9b0; F
+; TI"dependency_digest; TI"%9da377244b69e1a3bae3f921893d9072; FI"required_paths; T[I"c/Users/simon/Documents/rainforest/prosperity/app/assets/javascripts/prosperity/graph.js.coffee; FI"dependency_paths; T[{I" path; TI"c/Users/simon/Documents/rainforest/prosperity/app/assets/javascripts/prosperity/graph.js.coffee; FI"
+mtime; TI"2014-05-16T11:40:44-07:00; TI"digest; TI"%eb982557ca2b24dcb87cdb58b2d067ed; FI"
_version; TI"%2b66aa67c90052d553e0328c249bc9b0; F
\ No newline at end of file