1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 window.onload = function() {
10 if (y > 1000000000) { y=y/1000000000; s='G'; }
11 else if (y > 1000000) { y=y/1000000; s='M'; }
12 else if (y > 1000) { y=y/1000; s='K'; }
13 return y.toFixed(2).replace(/\.0+$/, '')+s;
18 var u = 'm'+(s%60)+'s';
19 var m = Math.floor(s/60);
20 if (m < 60) return ''+m+u;
22 var h = Math.floor(m/60);
23 if (h < 24) return ''+h+u;
25 return ''+Math.floor(h/24)+u;
28 chartdata.forEach(function(section, section_idx) {
29 var h1 = document.createElement('h1');
30 h1.appendChild(document.createTextNode(section.label));
31 document.body.appendChild(h1);
32 section.charts.forEach(function(chart, chart_idx) {
33 // Skip chart if every series has zero data points
34 if (0 == chart.data.reduce(function(len, series) {
35 return len + series.length;
39 var id = 'chart-'+section_idx+'-'+chart_idx;
40 var div = document.createElement('div');
41 div.setAttribute('id', id);
42 div.setAttribute('style', 'width: 100%; height: 150px');
43 document.body.appendChild(div);
44 chart.options.valueFormatter = function(y) {
46 chart.options.axes = {
48 axisLabelFormatter: fmt.time,
49 valueFormatter: fmt.time,
52 axisLabelFormatter: fmt.iso,
53 valueFormatter: fmt.iso,
56 charts[id] = new Dygraph(div, chart.data, chart.options);
60 if (typeof window.debug === 'undefined')
62 window.debug.charts = charts;