commit 07710b1f0dd67c1a780a8cf2874fc094feea2663
parent 208e68ca800b312986a75129a1ff10ece8f955d7
Author: Chris Bracken <chris@bracken.jp>
Date: Sat, 13 Nov 2021 10:49:08 -0800
Add particulate matter charts
Diffstat:
2 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/static/dashboard.html b/static/dashboard.html
@@ -10,6 +10,8 @@
<canvas id="chart-temperature"></canvas>
<canvas id="chart-humidity"></canvas>
<canvas id="chart-pressure"></canvas>
+<canvas id="chart-pm25"></canvas>
+<canvas id="chart-pm10"></canvas>
</body>
<!-- Load chart scripts -->
diff --git a/static/tempestas.js b/static/tempestas.js
@@ -5,12 +5,38 @@
const API_SERVER = 'http://minerva'
// TODO: automate colour generation.
-var colors = ['rgb(75, 192, 192)', 'rgb(255, 99, 132)', 'rgb(255, 159, 64)'];
+var colors = ['rgb(255, 99, 132)', 'rgb(255, 159, 64)', 'rgb(75, 192, 192)'];
var sensors = [];
var charts = [
- {id: 'chart-temperature', title: 'Temperature (°C)', readingType: 'BME280_temperature'},
- {id: 'chart-humidity', title: 'Humidity (%)', readingType: 'BME280_humidity'},
- {id: 'chart-pressure', title: 'Pressure (Pa)', readingType: 'BME280_pressure'},
+ {
+ id: 'chart-temperature',
+ title: 'Temperature (°C)',
+ readingType: 'BME280_temperature'
+ },
+ {
+ id: 'chart-humidity',
+ title: 'Humidity (%)',
+ readingType: 'BME280_humidity'},
+ {
+ id: 'chart-pressure',
+ title: 'Pressure (Pa)',
+ readingType: 'BME280_pressure'
+ },
+ {
+ id: 'chart-pm25',
+ title: 'Particulate Matter 2.5 μm (μg/m³)',
+ readingType: 'SDS_P1'
+ },
+ {
+ id: 'chart-pm10',
+ title: 'Particulate Matter 10 μm (μg/m³)',
+ readingType: 'SDS_P2'
+ },
+ {
+ id: 'chart-pressure',
+ title: 'Pressure (Pa)',
+ readingType: 'BME280_pressure'
+ },
];
var sensorReadings = {};