aboutsummaryrefslogtreecommitdiffstats
path: root/web/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/main.js')
-rw-r--r--web/main.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/web/main.js b/web/main.js
index 51e2a3a..4d72357 100644
--- a/web/main.js
+++ b/web/main.js
@@ -33,6 +33,13 @@ let END_TIME = null;
let TIMEOUT;
let TEMPS = '';
+const PLOTS = {
+ temp1: plot.addPlot('temp1'),
+ temp2: plot.addPlot('temp2'),
+ temp3: plot.addPlot('temp3'),
+ tempavg: plot.addPlot('tempavg'),
+};
+
const elements = [
'temps',
'connect', 'status', 'profile', 'start', 'read', 'write',
@@ -134,7 +141,12 @@ const onMessage = async (msg) => {
if (!STATUS || STATUS === 'connecting') {
STATUS = 'idle';
} else if (STATUS === 'running' || STATUS == 'manual') {
- plot.addPoint((temp1 + temp2) / 2);
+ const t = PLOTS.temp1.data.length;
+ PLOTS.temp1.data.push([t, temp1]);
+ PLOTS.temp2.data.push([t, temp2]);
+ PLOTS.temp3.data.push([t, temp3]);
+ PLOTS.tempavg.data.push([t, (temp1 + temp2) / 2]);
+ plot.update();
}
break;
}
@@ -234,7 +246,12 @@ el.start.onclick = () => {
if (el.profile.value !== '') {
const i = +el.profile.value;
send8(FUNC.C_STARTSTOP, i, ARG.STARTSTOP_START);
- plot.clear();
+
+ PLOTS.temp1.data.length = 0;
+ PLOTS.temp2.data.length = 0;
+ PLOTS.temp3.data.length = 0;
+ PLOTS.tempavg.data.length = 0;
+ plot.update();
}
} else if (STATUS === 'running') {
STATUS = 'idle';