TDR Messung in Chart.js implementieren

This commit is contained in:
ISA
2024-10-22 13:40:35 +02:00
parent 803816bf4b
commit 94e749efc1
65 changed files with 120 additions and 7 deletions

1
LastTDR/slot0.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ0%>

1
LastTDR/slot1.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ1%>

1
LastTDR/slot10.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ10%>

1
LastTDR/slot11.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ11%>

1
LastTDR/slot12.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ12%>

1
LastTDR/slot13.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ13%>

1
LastTDR/slot14.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ14%>

1
LastTDR/slot15.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ15%>

1
LastTDR/slot16.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ16%>

1
LastTDR/slot17.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ17%>

1
LastTDR/slot18.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ18%>

1
LastTDR/slot19.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ19%>

1
LastTDR/slot2.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ1%>

1
LastTDR/slot20.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ20%>

1
LastTDR/slot21.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ21%>

1
LastTDR/slot22.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ22%>

1
LastTDR/slot23.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ23%>

1
LastTDR/slot24.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ24%>

1
LastTDR/slot25.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ25%>

1
LastTDR/slot26.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ26%>

1
LastTDR/slot27.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ27%>

1
LastTDR/slot28.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ28%>

1
LastTDR/slot29.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ29%>

1
LastTDR/slot3.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ3%>

1
LastTDR/slot30.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ30%>

1
LastTDR/slot31.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ31%>

1
LastTDR/slot4.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ4%>

1
LastTDR/slot5.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ5%>

1
LastTDR/slot6.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ6%>

1
LastTDR/slot7.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ7%>

1
LastTDR/slot8.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ8%>

1
LastTDR/slot9.json Normal file
View File

@@ -0,0 +1 @@
<%=KTZ9%>

View File

@@ -36,27 +36,46 @@ function Kue705FO({
// Funktion zum Anzeigen des Chart-Modals
const handleOpenChartModal = () => {
setShowChartModal(true);
loadChartData(); // Lade die Daten, wenn das Modal geöffnet wird
if (activeButton === "TDR") {
loadTDRChartData(); // Lade TDR-Daten, wenn der TDR-Button aktiv ist
} else {
loadLoopChartData(); // Andernfalls lade die Schleifenmessdaten
}
};
const handleCloseChartModal = () => {
setShowChartModal(false);
};
// Daten laden und den Chart erstellen
const loadChartData = () => {
// Daten laden und den TDR-Chart erstellen
const loadTDRChartData = () => {
const slot = slotIndex;
const fileData = `../cpl?4000values/slot${slot}.json`; // Je nach Slot wird die entsprechende Datei geladen
const fileData = `../cpl?lastTDR/slot${slot}.json`; // TDR-Daten je nach Slot laden
fetch(fileData)
.then((response) => response.json())
.then((data) => {
setChartData(data); // Daten setzen
createChart(data);
console.log("Messkurvendaten geladen:", data);
createTDRChart(data); // Chart für TDR-Messung erstellen
})
.catch((error) => {
console.error("Fehler beim Laden der Messkurvendaten:", error);
console.error("Fehler beim Laden der TDR-Messkurvendaten:", error);
});
};
// Daten laden und den Schleifenmessungs-Chart erstellen
const loadLoopChartData = () => {
const slot = slotIndex;
const fileData = `../cpl?4000values/slot${slot}.json`; // Schleifenmessdaten je nach Slot laden
fetch(fileData)
.then((response) => response.json())
.then((data) => {
setChartData(data); // Daten setzen
createChart(data, "Schleifenmesskurve"); // Chart für Schleifenmessung erstellen
})
.catch((error) => {
console.error("Fehler beim Laden der Schleifenmesskurvendaten:", error);
});
};
@@ -112,6 +131,36 @@ function Kue705FO({
},
});
};
// Funktion zum Erstellen des TDR-Charts
const createTDRChart = (dataTDR) => {
const ctx = document.getElementById("myChart").getContext("2d");
new Chart(ctx, {
type: "line",
data: {
labels: dataTDR.map((row) => row.t), // Entfernung oder Zeit auf der x-Achse
datasets: [
{
label: "Pegel",
data: dataTDR.map((row) => row.m), // Nur Pegel auf der y-Achse
borderColor: "#00AEEF",
borderWidth: 1,
pointBorderWidth: 0,
pointStyle: false,
fill: false,
},
],
},
options: {
scales: {
y: {
type: "linear",
position: "left",
},
},
},
});
};
// Funktion für die TDR-Messung
const goTDR = () => {

View File

@@ -0,0 +1 @@
<%=KTZ0%>

View File

@@ -0,0 +1 @@
<%=KTZ1%>

View File

@@ -0,0 +1 @@
<%=KTZ10%>

View File

@@ -0,0 +1 @@
<%=KTZ11%>

View File

@@ -0,0 +1 @@
<%=KTZ12%>

View File

@@ -0,0 +1 @@
<%=KTZ13%>

View File

@@ -0,0 +1 @@
<%=KTZ14%>

View File

@@ -0,0 +1 @@
<%=KTZ15%>

View File

@@ -0,0 +1 @@
<%=KTZ16%>

View File

@@ -0,0 +1 @@
<%=KTZ17%>

View File

@@ -0,0 +1 @@
<%=KTZ18%>

View File

@@ -0,0 +1 @@
<%=KTZ19%>

View File

@@ -0,0 +1 @@
<%=KTZ1%>

View File

@@ -0,0 +1 @@
<%=KTZ20%>

View File

@@ -0,0 +1 @@
<%=KTZ21%>

View File

@@ -0,0 +1 @@
<%=KTZ22%>

View File

@@ -0,0 +1 @@
<%=KTZ23%>

View File

@@ -0,0 +1 @@
<%=KTZ24%>

View File

@@ -0,0 +1 @@
<%=KTZ25%>

View File

@@ -0,0 +1 @@
<%=KTZ26%>

View File

@@ -0,0 +1 @@
<%=KTZ27%>

View File

@@ -0,0 +1 @@
<%=KTZ28%>

View File

@@ -0,0 +1 @@
<%=KTZ29%>

View File

@@ -0,0 +1 @@
<%=KTZ3%>

View File

@@ -0,0 +1 @@
<%=KTZ30%>

View File

@@ -0,0 +1 @@
<%=KTZ31%>

View File

@@ -0,0 +1 @@
<%=KTZ4%>

View File

@@ -0,0 +1 @@
<%=KTZ5%>

View File

@@ -0,0 +1 @@
<%=KTZ6%>

View File

@@ -0,0 +1 @@
<%=KTZ7%>

View File

@@ -0,0 +1 @@
<%=KTZ8%>

View File

@@ -0,0 +1 @@
<%=KTZ9%>