From 49c389dc854bd7858415b513272d6b7410b5a23d Mon Sep 17 00:00:00 2001 From: dLedda Date: Thu, 5 Nov 2020 13:30:21 +0000 Subject: [PATCH] Fixed the order or data points before inserting into chart --- charts.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/charts.html b/charts.html index 0faae55..c3fe7bf 100644 --- a/charts.html +++ b/charts.html @@ -105,7 +105,8 @@ const humidity = []; const co2 = []; const temp = []; - for (const snapshot of json.snapshots) { + for (let i = 0; i < json.snapshots.length; i++) { + const snapshot = json.snapshots[json.snapshots.length - i - 1]; co2.push({x: snapshot.time, y: snapshot.co2}); temp.push({x: snapshot.time, y: snapshot.temp}); humidity.push({x: snapshot.time, y: snapshot.humidity}); @@ -128,4 +129,4 @@ - \ No newline at end of file +