commit 802defb4fa4ba3309dbe0f06a34a82d01d3d9f5e
parent 786bf96946c4fd1c6f8174e9f8cb3449ca2b6ee2
Author: Gerco van Woudenbergh <[email protected]>
Date: Tue, 13 Jun 2023 14:22:03 +0200
Merge branch 'datatowebsite' of https://github.com/friedelschoen/iwa-panda into datatowebsite
Diffstat:
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/css/dashboard.css b/css/dashboard.css
@@ -60,7 +60,7 @@ nav ul li:first-child {
.download-button {
display: flex;
padding: 10px 20px;
- background-color: rgb(207, 72, 72);
+ background-color: #BC9999;
color: white;
text-decoration: none;
cursor: pointer;
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)');