feat: Add units (MOhm, kOhm) to chart axes in Schleifenmessung and Isolationswiderstand

feat: Log chart data in console for each slot in createChart function
This commit is contained in:
ISA
2024-10-24 10:19:33 +02:00
parent 6cd347a6c4
commit 0bb66f6965
2 changed files with 17 additions and 7 deletions

View File

@@ -288,15 +288,14 @@ function Dashboard() {
<div className="flex flex-row p-2 space-x-2">
<Icon icon="bx:code-block" className="text-xl text-blue-400" />
<p className="text-sm text-gray-600">
<span className="font-bold">
Applikationsversion: {appVersion}{" "}
</span>
<span className="font-bold"></span> Applikationsversion:{" "}
{appVersion}{" "}
</p>
</div>
<div className="flex flex-row p-2 space-x-2">
<Icon icon="mdi:web" className="text-xl text-blue-400" />
<p className="text-sm text-gray-600">
<span className="font-bold">Webserverversion: </span> 1.0.0
<span className="font-bold"> </span>Webserverversion: 1.0.0
</p>
</div>
</div>

View File

@@ -80,6 +80,7 @@ function Kue705FO({
});
};
// Funktion zum Erstellen des Charts
// Funktion zum Erstellen des Charts
const createChart = (data) => {
const ctx = document.getElementById("myChart").getContext("2d");
@@ -96,21 +97,22 @@ function Kue705FO({
second: "2-digit",
}).format(date);
};
// Ausgabe der Chart-Daten in der Konsole mit Slot-Informationen
console.log(`Chart-Daten für Slot ${slotIndex + 1}:`, data);
new Chart(ctx, {
type: "line",
data: {
labels: data.map((row) => formatToGermanDate(row.t)).reverse(), // Zeitwerte ins deutsche Format umwandeln und umkehren
datasets: [
{
label: "Isolationswiderstand",
label: "Isolationswiderstand (MOhm)", // Einheit hinzugefügt
data: data.map((row) => row.m).reverse(),
borderColor: "#00AEEF",
fill: false,
yAxisID: "y",
},
{
label: "Schleifenwiderstand",
label: "Schleifenwiderstand (kOhm)", // Einheit hinzugefügt
data: data.map((row) => row.n).reverse(),
borderColor: "black",
fill: false,
@@ -123,15 +125,24 @@ function Kue705FO({
y: {
type: "linear",
position: "left",
title: {
display: true,
text: "MOhm", // Einheit für linke Achse hinzugefügt
},
},
y1: {
type: "linear",
position: "right",
title: {
display: true,
text: "kOhm", // Einheit für rechte Achse hinzugefügt
},
},
},
},
});
};
// Funktion zum Erstellen des TDR-Charts
const createTDRChart = (dataTDR) => {
const ctx = document.getElementById("myChart").getContext("2d");