Changed endpoints and db queries, chart now shows suggested mins and maxes

This commit is contained in:
Daniel Ledda
2020-11-07 15:58:12 +01:00
parent 8226610934
commit 6b16a0188b

View File

@@ -129,7 +129,8 @@
setInterval(async () => { setInterval(async () => {
const newDatum = await fetch("/" + ROOT_URL + "data/last/"); const newDatum = await fetch("/" + ROOT_URL + "data/last/");
const snapshot = (await newDatum.json()).snapshots[0]; const snapshot = (await newDatum.json()).snapshots[0];
if (snapshot.time !== chart.data.datasets[0].x) { const latestTime = chart.data.datasets[0].data[chart.data.datasets[0].data - 1].x;
if (snapshot.time !== latestTime) {
removeExpiredData(chart, snapshot.time); removeExpiredData(chart, snapshot.time);
insertSnapshot(chart, snapshot); insertSnapshot(chart, snapshot);
} }