diff options
author | Mark Longair <mhl@pobox.com> | 2013-09-26 10:50:12 +0100 |
---|---|---|
committer | Mark Longair <mhl@pobox.com> | 2013-09-30 10:34:31 +0100 |
commit | 36a22217703ab9d55989b2a52f49b6b045a605b4 (patch) | |
tree | 1df9b2bb2379e0e663a31ca1ca7b2fa2a0d8a111 /public/javascripts/stats-graphs.js | |
parent | 156fe47124d2d0001c1f5050695742b7022bda3c (diff) |
Switch Javascript (bar admin) to be served with the asset pipline
Diffstat (limited to 'public/javascripts/stats-graphs.js')
-rw-r--r-- | public/javascripts/stats-graphs.js | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/public/javascripts/stats-graphs.js b/public/javascripts/stats-graphs.js deleted file mode 100644 index 73e19a6fc..000000000 --- a/public/javascripts/stats-graphs.js +++ /dev/null @@ -1,87 +0,0 @@ -/* From http://stackoverflow.com/a/10284006/223092 */ -function zip(arrays) { - return arrays[0].map(function(_,i){ - return arrays.map(function(array){return array[i]}) - }); -} - -$(document).ready(function() { - $.each(graphs_data, function(index, graph_data) { - var graph_id = graph_data.id, - dataset, - plot, - graph_data, - graph_div = $('#' + graph_id); - - if (!graph_data.x_values) { - /* Then there's no data for this graph */ - return true; - } - - graph_div.css('width', '700px'); - graph_div.css('height', '400px'); - - dataset = [ - {'color': 'orange', - 'bars': { - 'show': true, - 'barWidth': 0.5, - 'align': 'center' - }, - 'data': zip([graph_data.x_values, - graph_data.y_values]) - } - ] - - if (graph_data.errorbars) { - dataset.push({ - 'color': 'orange', - 'points': { - // Don't show these, just draw error bars: - 'radius': 0, - 'errorbars': 'y', - 'yerr': { - 'asymmetric': true, - 'show': true, - 'upperCap': "-", - 'lowerCap': "-", - 'radius': 5 - } - }, - 'data': zip([graph_data.x_values, - graph_data.y_values, - graph_data.cis_below, - graph_data.cis_above]) - }); - } - - options = { - 'xaxis': { - 'ticks': graph_data.x_ticks, - }, - 'yaxis': { - 'min': 0, - 'max': graph_data.y_max - }, - 'xaxes': [{ - 'axisLabel': graph_data.x_axis, - 'axisLabelPadding': 20, - 'axisLabelColour': 'black' - }], - 'yaxes': [{ - 'axisLabel': graph_data.y_axis, - 'axisLabelPadding': 20, - 'axisLabelColour': 'black' - }], - 'series': { - 'lines': { - 'show': false - } - }, - } - - plot = $.plot(graph_div, - dataset, - options); - }); -}); |