commit 239f9d8613a3a2129e41e43b7224e7dd24a08906
parent 9ac3a7588d1e4046a19f6ba321ff95dd08183dee
Author: DennyVB <[email protected]>
Date: Tue, 13 Jun 2023 13:56:16 +0200
onwijs goede tijden nu. Grafiek update
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/js/panda.js b/js/panda.js
@@ -128,9 +128,15 @@ function fetchDataAndUpdateChart() {
let firstDate = getFirstDate(chengduData.slice(0), kangdingData.slice(0));
let latestDate = getLatestDate(chengduData.slice(-1), kangdingData.slice(-1));
+ let fourthDate = chengduData.slice(-2)
+ let thirdDate = chengduData.slice(-3)
+ let secondDate = chengduData.slice(-4)
myChart.data.labels[0] = firstDate[0]['datetime'];
myChart.data.labels[4] = latestDate[0]['datetime'];
+ myChart.data.labels[3] = fourthDate[0]['datetime'];
+ myChart.data.labels[2] = thirdDate[0]['datetime'];
+ myChart.data.labels[1] = secondDate[0]['datetime'];
myChart.data.datasets[0].pointBackgroundColor = chengduHumidity.map(value => value > 80 ? 'rgba(207, 72, 72, 1)' : 'rgba(176, 204, 207, 1)');
myChart.data.datasets[0].pointBorderColor = chengduHumidity.map(value => value > 80 ? 'rgba(207, 72, 72, 1)' : 'rgba(176, 204, 207, 1)');