From df1411e42481f8e788b9b40e3375715979bc7a0c Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Thu, 7 Dec 2017 12:50:32 +0100 Subject: Fixes. --- web/js/AllDataChart.js | 16 ++++------------ web/js/LastWeekDataChart.js | 16 ++++------------ 2 files changed, 8 insertions(+), 24 deletions(-) (limited to 'web/js') diff --git a/web/js/AllDataChart.js b/web/js/AllDataChart.js index 8de05cf..6525382 100644 --- a/web/js/AllDataChart.js +++ b/web/js/AllDataChart.js @@ -22,10 +22,7 @@ var datasets = [{ borderColor: "rgb(246, 250, 15)", fill: false, data: [] -}] - - - +}]; fetch('/AllDataAverage') .then(function(response) { @@ -33,28 +30,23 @@ fetch('/AllDataAverage') }) .then(function(data) { drawChart(data, datasets); - }) - - - - + }); function drawChart(gasData, datasets) { var finishedData = { labels: [] - } + }; Object.keys(gasData).forEach(function(key) { finishedData.labels.push(key); - datasets[0].data.push(gasData[key].Co) + datasets[0].data.push(gasData[key].Co); datasets[1].data.push(gasData[key].No); datasets[2].data.push(gasData[key].So); }); finishedData.datasets = datasets; - var myLineChart = new Chart(ctx, { type: 'line', data: finishedData, diff --git a/web/js/LastWeekDataChart.js b/web/js/LastWeekDataChart.js index a24d51a..b5e3976 100644 --- a/web/js/LastWeekDataChart.js +++ b/web/js/LastWeekDataChart.js @@ -22,10 +22,7 @@ var datasets = [{ borderColor: "rgb(246, 250, 15)", fill: false, data: [] -}] - - - +}]; fetch('/LastWeekDataAverage') .then(function(response) { @@ -33,28 +30,23 @@ fetch('/LastWeekDataAverage') }) .then(function(data) { drawChart(data, datasets); - }) - - - - + }); function drawChart(gasData, datasets) { var finishedData = { labels: [] - } + }; Object.keys(gasData).forEach(function(key) { finishedData.labels.push(key); - datasets[0].data.push(gasData[key].Co) + datasets[0].data.push(gasData[key].Co); datasets[1].data.push(gasData[key].No); datasets[2].data.push(gasData[key].So); }); finishedData.datasets = datasets; - var myLineChart = new Chart(ctx, { type: 'line', data: finishedData, -- cgit v1.2.3