commit 208e68ca800b312986a75129a1ff10ece8f955d7
parent 4fac2b2d643d67c8b1f43c746eb8fa333c52f946
Author: Chris Bracken <chris@bracken.jp>
Date: Sat, 13 Nov 2021 09:25:32 -0800
Convert tabs to spaces in JavaScript
Diffstat:
M | static/tempestas.js | | | 96 | ++++++++++++++++++++++++++++++++++++++++---------------------------------------- |
1 file changed, 48 insertions(+), 48 deletions(-)
diff --git a/static/tempestas.js b/static/tempestas.js
@@ -8,9 +8,9 @@ const API_SERVER = 'http://minerva'
var colors = ['rgb(75, 192, 192)', 'rgb(255, 99, 132)', 'rgb(255, 159, 64)'];
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'},
];
var sensorReadings = {};
@@ -42,51 +42,51 @@ function fetchSensorData(sensorId, chart) {
}
function updateChart(chart) {
- for (let i = 0; i < sensors.length; i++) {
- var sensorId = sensors[i].id;
- if (sensorReadings[chart.id][sensorId] == null) {
- return;
- }
- }
+ for (let i = 0; i < sensors.length; i++) {
+ var sensorId = sensors[i].id;
+ if (sensorReadings[chart.id][sensorId] == null) {
+ return;
+ }
+ }
- data = {
- labels: sensorReadings[chart.id][sensors[0].id].map(e => Date.parse(e.time)),
- datasets: [],
- };
- for (let i = 0; i < sensors.length; i++) {
- var sensorId = sensors[i].id;
- data.datasets.push({
- data: sensorReadings[chart.id][sensorId].map(e => { return {x: Date.parse(e.time), y: e.value}; }),
- label: sensors[i].name,
- radius: 0,
- borderWidth: 1,
- borderColor: sensors[i].color,
- fill: false,
- });
- }
+ data = {
+ labels: sensorReadings[chart.id][sensors[0].id].map(e => Date.parse(e.time)),
+ datasets: [],
+ };
+ for (let i = 0; i < sensors.length; i++) {
+ var sensorId = sensors[i].id;
+ data.datasets.push({
+ data: sensorReadings[chart.id][sensorId].map(e => { return {x: Date.parse(e.time), y: e.value}; }),
+ label: sensors[i].name,
+ radius: 0,
+ borderWidth: 1,
+ borderColor: sensors[i].color,
+ fill: false,
+ });
+ }
- var ctx = document.getElementById(chart.id).getContext('2d');
- var chart = new Chart(ctx, {
- type: 'line',
- data: data,
- options: {
- plugins: {
- title: {
- display: true,
- text: chart.title,
- },
- legend: {
- position: 'bottom',
- },
- },
- scales: {
- x: {
- type: 'time',
- time: {
- unit: 'hour',
- },
- },
- },
- },
- });
+ var ctx = document.getElementById(chart.id).getContext('2d');
+ var chart = new Chart(ctx, {
+ type: 'line',
+ data: data,
+ options: {
+ plugins: {
+ title: {
+ display: true,
+ text: chart.title,
+ },
+ legend: {
+ position: 'bottom',
+ },
+ },
+ scales: {
+ x: {
+ type: 'time',
+ time: {
+ unit: 'hour',
+ },
+ },
+ },
+ },
+ });
}