diff options
author | Struan Donald <struan@exo.org.uk> | 2018-09-10 14:44:57 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2018-09-12 14:21:49 +0100 |
commit | 371cefadfe5c50610bc8abfb923757e39d66f3ff (patch) | |
tree | 2ce92d80c52b6c8a059ce1af2154ec8587ca47b6 /web/js | |
parent | 96cf649c4e7e7c9a6db8e129d48657d7e2e207ce (diff) |
make fixed reports line on reports graph optional
Collideoscope doesn't have fixed reports so only add a line for fixed
reports if there is data.
Diffstat (limited to 'web/js')
-rw-r--r-- | web/js/dashboard.js | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/web/js/dashboard.js b/web/js/dashboard.js index 318e64c76..848fb0c2e 100644 --- a/web/js/dashboard.js +++ b/web/js/dashboard.js @@ -139,21 +139,26 @@ $(function(){ data0 = $allReports.data('values-reports'), data1 = $allReports.data('values-fixed'); - window.chartAllReports = new Chart($allReports, { - type: 'line', - data: { - labels: labels, - datasets: [{ - data: data0, - pointRadius: pointRadiusFinalDot(data0.length, 4), - pointBackgroundColor: colours[1], - borderColor: colours[1] - }, { + var data = [{ + data: data0, + pointRadius: pointRadiusFinalDot(data0.length, 4), + pointBackgroundColor: colours[1], + borderColor: colours[1] + }]; + if ( data1 ) { + data.push({ data: data1, pointRadius: pointRadiusFinalDot(data1.length, 4), pointBackgroundColor: colours[3], borderColor: colours[3] - }] + }); + } + + window.chartAllReports = new Chart($allReports, { + type: 'line', + data: { + labels: labels, + datasets: data }, options: { animation: { |