Fixed the order or data points before inserting into chart

This commit is contained in:
2020-11-05 13:30:21 +00:00
parent 20e1a45ea0
commit 49c389dc85

View File

@@ -105,7 +105,8 @@
const humidity = []; const humidity = [];
const co2 = []; const co2 = [];
const temp = []; 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}); co2.push({x: snapshot.time, y: snapshot.co2});
temp.push({x: snapshot.time, y: snapshot.temp}); temp.push({x: snapshot.time, y: snapshot.temp});
humidity.push({x: snapshot.time, y: snapshot.humidity}); humidity.push({x: snapshot.time, y: snapshot.humidity});
@@ -128,4 +129,4 @@
</script> </script>
</body> </body>
</html> </html>