Add labels to each channel

This commit is contained in:
huskee 2023-12-19 22:28:33 +02:00
parent 688e8f03bb
commit efd4c76997
2 changed files with 8 additions and 2 deletions

View file

@ -29,11 +29,13 @@
<tr> <tr>
<td class="chart-container"> <td class="chart-container">
<h2>Channel A:</h2> <h2>Channel A:</h2>
<label for="labelA">label: </label><input type="text" value="tempA" id="labelA">
<div id="error-tempA"></div> <div id="error-tempA"></div>
<canvas id="chartA"></canvas> <canvas id="chartA"></canvas>
</td> </td>
<td class="chart-container"> <td class="chart-container">
<h2>Channel B:</h2> <h2>Channel B:</h2>
<label for="labelB">label: </label><input type="text" value="tempB" id="labelB">
<div id="error-tempB"></div> <div id="error-tempB"></div>
<canvas id="chartB"></canvas> <canvas id="chartB"></canvas>
</td> </td>

View file

@ -5,7 +5,8 @@ document.getElementById("stopRec").disabled = true;
let data; let data;
let record = 0; let record = 0;
let filename; let filename;
const csvData = ["time, tempA, tempB"]; let csvData;
let labelA, labelB;
const chartAdata = { const chartAdata = {
data: { data: {
labels: [], labels: [],
@ -250,6 +251,9 @@ function startRecording() {
date = new Date(); date = new Date();
let filedate = date.toISOString().slice(0, -5).replaceAll(":", ""); let filedate = date.toISOString().slice(0, -5).replaceAll(":", "");
filename = "therminator-" + filedate + ".csv"; filename = "therminator-" + filedate + ".csv";
labelA = document.getElementById("labelA").value;
labelB = document.getElementById("labelB").value;
csvData = ["time,\"" + labelA + "\",\"" + labelB + "\""]
record = 1; record = 1;
document.getElementById("startRec").disabled = true; document.getElementById("startRec").disabled = true;
document.getElementById("stopRec").disabled = false; document.getElementById("stopRec").disabled = false;