Add support for second voltage column
This commit is contained in:
parent
c7ace97ef0
commit
dcf8069f68
|
@ -36,9 +36,11 @@ function initCharts() {
|
||||||
columns: [
|
columns: [
|
||||||
['time', 1, 2, 3, 4],
|
['time', 1, 2, 3, 4],
|
||||||
['voltage', 24, 24.5, 24.3, 24.6],
|
['voltage', 24, 24.5, 24.3, 24.6],
|
||||||
|
['voltage2', 24, 24.5, 24.3, 24.6],
|
||||||
],
|
],
|
||||||
axes: {
|
axes: {
|
||||||
voltage: 'y',
|
voltage: 'y',
|
||||||
|
voltage2: 'y',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
axis: {
|
axis: {
|
||||||
|
@ -62,6 +64,7 @@ var time = []
|
||||||
var temp = []
|
var temp = []
|
||||||
var humd = []
|
var humd = []
|
||||||
var volts = []
|
var volts = []
|
||||||
|
var volts2 = []
|
||||||
|
|
||||||
function status(msg) {
|
function status(msg) {
|
||||||
document.getElementById('status').textContent = msg
|
document.getElementById('status').textContent = msg
|
||||||
|
@ -112,6 +115,7 @@ async function updateCharts() {
|
||||||
temp.push(v.temp)
|
temp.push(v.temp)
|
||||||
humd.push(v.hum)
|
humd.push(v.hum)
|
||||||
volts.push(v.hv)
|
volts.push(v.hv)
|
||||||
|
volts2.push(v.hv2)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// truncate all the lists as necessary
|
// truncate all the lists as necessary
|
||||||
|
@ -131,11 +135,13 @@ async function updateCharts() {
|
||||||
temp = temp.slice(slice_idx)
|
temp = temp.slice(slice_idx)
|
||||||
humd = humd.slice(slice_idx)
|
humd = humd.slice(slice_idx)
|
||||||
volts = volts.slice(slice_idx)
|
volts = volts.slice(slice_idx)
|
||||||
|
volts2 = volts2.slice(slice_idx)
|
||||||
time = time.slice(slice_idx)
|
time = time.slice(slice_idx)
|
||||||
|
|
||||||
const temp_d = temp.filter((_, idx) => (idx % decimation_rate) == 0)
|
const temp_d = temp.filter((_, idx) => (idx % decimation_rate) == 0)
|
||||||
const humd_d = humd.filter((_, idx) => (idx % decimation_rate) == 0)
|
const humd_d = humd.filter((_, idx) => (idx % decimation_rate) == 0)
|
||||||
const volts_d = volts.filter((_, idx) => (idx % decimation_rate) == 0)
|
const volts_d = volts.filter((_, idx) => (idx % decimation_rate) == 0)
|
||||||
|
const volts2_d = volts2.filter((_, idx) => (idx % decimation_rate) == 0)
|
||||||
const time_d = time.filter((_, idx) => (idx % decimation_rate) == 0)
|
const time_d = time.filter((_, idx) => (idx % decimation_rate) == 0)
|
||||||
|
|
||||||
chart.load({
|
chart.load({
|
||||||
|
@ -149,6 +155,7 @@ async function updateCharts() {
|
||||||
columns: [
|
columns: [
|
||||||
["time"].concat(time_d),
|
["time"].concat(time_d),
|
||||||
["voltage"].concat(volts_d),
|
["voltage"].concat(volts_d),
|
||||||
|
["voltage2"].concat(volts2_d),
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
status("charts updated")
|
status("charts updated")
|
||||||
|
@ -263,6 +270,7 @@ window.onload = () => {
|
||||||
temp = []
|
temp = []
|
||||||
humd = []
|
humd = []
|
||||||
volts = []
|
volts = []
|
||||||
|
volts2 = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue