8784: Fix test for latest firefox.
[arvados.git] / tools / crunchstat-summary / crunchstat_summary / chartjs.js
1 window.onload = function() {
2     var charts = {};
3     sections.forEach(function(section, section_idx) {
4         var h1 = document.createElement('h1');
5         h1.appendChild(document.createTextNode(section.label));
6         document.body.appendChild(h1);
7         section.charts.forEach(function(data, chart_idx) {
8             // Skip chart if every series has zero data points
9             if (0 == data.data.reduce(function(len, series) {
10                 return len + series.dataPoints.length;
11             }, 0)) {
12                 return;
13             }
14             var id = 'chart-'+section_idx+'-'+chart_idx;
15             var div = document.createElement('div');
16             div.setAttribute('id', id);
17             div.setAttribute('style', 'width: 100%; height: 150px');
18             document.body.appendChild(div);
19             charts[id] = new CanvasJS.Chart(id, data);
20             charts[id].render();
21         });
22     });
23
24     if (typeof window.debug === 'undefined')
25         window.debug = {};
26     window.debug.charts = charts;
27 };