From 94e749efc1beb8a36a8f156b52e3b9e0d98d6e00 Mon Sep 17 00:00:00 2001 From: ISA Date: Tue, 22 Oct 2024 13:40:35 +0200 Subject: [PATCH] TDR Messung in Chart.js implementieren --- LastTDR/slot0.json | 1 + LastTDR/slot1.json | 1 + LastTDR/slot10.json | 1 + LastTDR/slot11.json | 1 + LastTDR/slot12.json | 1 + LastTDR/slot13.json | 1 + LastTDR/slot14.json | 1 + LastTDR/slot15.json | 1 + LastTDR/slot16.json | 1 + LastTDR/slot17.json | 1 + LastTDR/slot18.json | 1 + LastTDR/slot19.json | 1 + LastTDR/slot2.json | 1 + LastTDR/slot20.json | 1 + LastTDR/slot21.json | 1 + LastTDR/slot22.json | 1 + LastTDR/slot23.json | 1 + LastTDR/slot24.json | 1 + LastTDR/slot25.json | 1 + LastTDR/slot26.json | 1 + LastTDR/slot27.json | 1 + LastTDR/slot28.json | 1 + LastTDR/slot29.json | 1 + LastTDR/slot3.json | 1 + LastTDR/slot30.json | 1 + LastTDR/slot31.json | 1 + LastTDR/slot4.json | 1 + LastTDR/slot5.json | 1 + LastTDR/slot6.json | 1 + LastTDR/slot7.json | 1 + LastTDR/slot8.json | 1 + LastTDR/slot9.json | 1 + components/modules/Kue705FO.jsx | 63 +++++++++++++++++++++++++++++---- public/LastTDR/slot0.json | 1 + public/LastTDR/slot1.json | 1 + public/LastTDR/slot10.json | 1 + public/LastTDR/slot11.json | 1 + public/LastTDR/slot12.json | 1 + public/LastTDR/slot13.json | 1 + public/LastTDR/slot14.json | 1 + public/LastTDR/slot15.json | 1 + public/LastTDR/slot16.json | 1 + public/LastTDR/slot17.json | 1 + public/LastTDR/slot18.json | 1 + public/LastTDR/slot19.json | 1 + public/LastTDR/slot2.json | 1 + public/LastTDR/slot20.json | 1 + public/LastTDR/slot21.json | 1 + public/LastTDR/slot22.json | 1 + public/LastTDR/slot23.json | 1 + public/LastTDR/slot24.json | 1 + public/LastTDR/slot25.json | 1 + public/LastTDR/slot26.json | 1 + public/LastTDR/slot27.json | 1 + public/LastTDR/slot28.json | 1 + public/LastTDR/slot29.json | 1 + public/LastTDR/slot3.json | 1 + public/LastTDR/slot30.json | 1 + public/LastTDR/slot31.json | 1 + public/LastTDR/slot4.json | 1 + public/LastTDR/slot5.json | 1 + public/LastTDR/slot6.json | 1 + public/LastTDR/slot7.json | 1 + public/LastTDR/slot8.json | 1 + public/LastTDR/slot9.json | 1 + 65 files changed, 120 insertions(+), 7 deletions(-) create mode 100644 LastTDR/slot0.json create mode 100644 LastTDR/slot1.json create mode 100644 LastTDR/slot10.json create mode 100644 LastTDR/slot11.json create mode 100644 LastTDR/slot12.json create mode 100644 LastTDR/slot13.json create mode 100644 LastTDR/slot14.json create mode 100644 LastTDR/slot15.json create mode 100644 LastTDR/slot16.json create mode 100644 LastTDR/slot17.json create mode 100644 LastTDR/slot18.json create mode 100644 LastTDR/slot19.json create mode 100644 LastTDR/slot2.json create mode 100644 LastTDR/slot20.json create mode 100644 LastTDR/slot21.json create mode 100644 LastTDR/slot22.json create mode 100644 LastTDR/slot23.json create mode 100644 LastTDR/slot24.json create mode 100644 LastTDR/slot25.json create mode 100644 LastTDR/slot26.json create mode 100644 LastTDR/slot27.json create mode 100644 LastTDR/slot28.json create mode 100644 LastTDR/slot29.json create mode 100644 LastTDR/slot3.json create mode 100644 LastTDR/slot30.json create mode 100644 LastTDR/slot31.json create mode 100644 LastTDR/slot4.json create mode 100644 LastTDR/slot5.json create mode 100644 LastTDR/slot6.json create mode 100644 LastTDR/slot7.json create mode 100644 LastTDR/slot8.json create mode 100644 LastTDR/slot9.json create mode 100644 public/LastTDR/slot0.json create mode 100644 public/LastTDR/slot1.json create mode 100644 public/LastTDR/slot10.json create mode 100644 public/LastTDR/slot11.json create mode 100644 public/LastTDR/slot12.json create mode 100644 public/LastTDR/slot13.json create mode 100644 public/LastTDR/slot14.json create mode 100644 public/LastTDR/slot15.json create mode 100644 public/LastTDR/slot16.json create mode 100644 public/LastTDR/slot17.json create mode 100644 public/LastTDR/slot18.json create mode 100644 public/LastTDR/slot19.json create mode 100644 public/LastTDR/slot2.json create mode 100644 public/LastTDR/slot20.json create mode 100644 public/LastTDR/slot21.json create mode 100644 public/LastTDR/slot22.json create mode 100644 public/LastTDR/slot23.json create mode 100644 public/LastTDR/slot24.json create mode 100644 public/LastTDR/slot25.json create mode 100644 public/LastTDR/slot26.json create mode 100644 public/LastTDR/slot27.json create mode 100644 public/LastTDR/slot28.json create mode 100644 public/LastTDR/slot29.json create mode 100644 public/LastTDR/slot3.json create mode 100644 public/LastTDR/slot30.json create mode 100644 public/LastTDR/slot31.json create mode 100644 public/LastTDR/slot4.json create mode 100644 public/LastTDR/slot5.json create mode 100644 public/LastTDR/slot6.json create mode 100644 public/LastTDR/slot7.json create mode 100644 public/LastTDR/slot8.json create mode 100644 public/LastTDR/slot9.json diff --git a/LastTDR/slot0.json b/LastTDR/slot0.json new file mode 100644 index 0000000..98a8890 --- /dev/null +++ b/LastTDR/slot0.json @@ -0,0 +1 @@ +<%=KTZ0%> diff --git a/LastTDR/slot1.json b/LastTDR/slot1.json new file mode 100644 index 0000000..edd4b48 --- /dev/null +++ b/LastTDR/slot1.json @@ -0,0 +1 @@ +<%=KTZ1%> diff --git a/LastTDR/slot10.json b/LastTDR/slot10.json new file mode 100644 index 0000000..62cce0d --- /dev/null +++ b/LastTDR/slot10.json @@ -0,0 +1 @@ +<%=KTZ10%> diff --git a/LastTDR/slot11.json b/LastTDR/slot11.json new file mode 100644 index 0000000..92c8578 --- /dev/null +++ b/LastTDR/slot11.json @@ -0,0 +1 @@ +<%=KTZ11%> diff --git a/LastTDR/slot12.json b/LastTDR/slot12.json new file mode 100644 index 0000000..3085cff --- /dev/null +++ b/LastTDR/slot12.json @@ -0,0 +1 @@ +<%=KTZ12%> diff --git a/LastTDR/slot13.json b/LastTDR/slot13.json new file mode 100644 index 0000000..f48d821 --- /dev/null +++ b/LastTDR/slot13.json @@ -0,0 +1 @@ +<%=KTZ13%> diff --git a/LastTDR/slot14.json b/LastTDR/slot14.json new file mode 100644 index 0000000..9d6c4f1 --- /dev/null +++ b/LastTDR/slot14.json @@ -0,0 +1 @@ +<%=KTZ14%> diff --git a/LastTDR/slot15.json b/LastTDR/slot15.json new file mode 100644 index 0000000..fe2745f --- /dev/null +++ b/LastTDR/slot15.json @@ -0,0 +1 @@ +<%=KTZ15%> diff --git a/LastTDR/slot16.json b/LastTDR/slot16.json new file mode 100644 index 0000000..de0a2a6 --- /dev/null +++ b/LastTDR/slot16.json @@ -0,0 +1 @@ +<%=KTZ16%> diff --git a/LastTDR/slot17.json b/LastTDR/slot17.json new file mode 100644 index 0000000..54cf9e0 --- /dev/null +++ b/LastTDR/slot17.json @@ -0,0 +1 @@ +<%=KTZ17%> diff --git a/LastTDR/slot18.json b/LastTDR/slot18.json new file mode 100644 index 0000000..b163760 --- /dev/null +++ b/LastTDR/slot18.json @@ -0,0 +1 @@ +<%=KTZ18%> diff --git a/LastTDR/slot19.json b/LastTDR/slot19.json new file mode 100644 index 0000000..ba2cf5d --- /dev/null +++ b/LastTDR/slot19.json @@ -0,0 +1 @@ +<%=KTZ19%> diff --git a/LastTDR/slot2.json b/LastTDR/slot2.json new file mode 100644 index 0000000..edd4b48 --- /dev/null +++ b/LastTDR/slot2.json @@ -0,0 +1 @@ +<%=KTZ1%> diff --git a/LastTDR/slot20.json b/LastTDR/slot20.json new file mode 100644 index 0000000..7b0450e --- /dev/null +++ b/LastTDR/slot20.json @@ -0,0 +1 @@ +<%=KTZ20%> diff --git a/LastTDR/slot21.json b/LastTDR/slot21.json new file mode 100644 index 0000000..d8d90e4 --- /dev/null +++ b/LastTDR/slot21.json @@ -0,0 +1 @@ +<%=KTZ21%> diff --git a/LastTDR/slot22.json b/LastTDR/slot22.json new file mode 100644 index 0000000..cd7acf4 --- /dev/null +++ b/LastTDR/slot22.json @@ -0,0 +1 @@ +<%=KTZ22%> diff --git a/LastTDR/slot23.json b/LastTDR/slot23.json new file mode 100644 index 0000000..87d169c --- /dev/null +++ b/LastTDR/slot23.json @@ -0,0 +1 @@ +<%=KTZ23%> diff --git a/LastTDR/slot24.json b/LastTDR/slot24.json new file mode 100644 index 0000000..d0ddbdf --- /dev/null +++ b/LastTDR/slot24.json @@ -0,0 +1 @@ +<%=KTZ24%> diff --git a/LastTDR/slot25.json b/LastTDR/slot25.json new file mode 100644 index 0000000..a2d1a5d --- /dev/null +++ b/LastTDR/slot25.json @@ -0,0 +1 @@ +<%=KTZ25%> diff --git a/LastTDR/slot26.json b/LastTDR/slot26.json new file mode 100644 index 0000000..0c90afc --- /dev/null +++ b/LastTDR/slot26.json @@ -0,0 +1 @@ +<%=KTZ26%> diff --git a/LastTDR/slot27.json b/LastTDR/slot27.json new file mode 100644 index 0000000..38e5d5e --- /dev/null +++ b/LastTDR/slot27.json @@ -0,0 +1 @@ +<%=KTZ27%> diff --git a/LastTDR/slot28.json b/LastTDR/slot28.json new file mode 100644 index 0000000..31c5555 --- /dev/null +++ b/LastTDR/slot28.json @@ -0,0 +1 @@ +<%=KTZ28%> diff --git a/LastTDR/slot29.json b/LastTDR/slot29.json new file mode 100644 index 0000000..921d4ea --- /dev/null +++ b/LastTDR/slot29.json @@ -0,0 +1 @@ +<%=KTZ29%> diff --git a/LastTDR/slot3.json b/LastTDR/slot3.json new file mode 100644 index 0000000..3d5e2d7 --- /dev/null +++ b/LastTDR/slot3.json @@ -0,0 +1 @@ +<%=KTZ3%> diff --git a/LastTDR/slot30.json b/LastTDR/slot30.json new file mode 100644 index 0000000..9b85999 --- /dev/null +++ b/LastTDR/slot30.json @@ -0,0 +1 @@ +<%=KTZ30%> diff --git a/LastTDR/slot31.json b/LastTDR/slot31.json new file mode 100644 index 0000000..a154b35 --- /dev/null +++ b/LastTDR/slot31.json @@ -0,0 +1 @@ +<%=KTZ31%> diff --git a/LastTDR/slot4.json b/LastTDR/slot4.json new file mode 100644 index 0000000..cc7b198 --- /dev/null +++ b/LastTDR/slot4.json @@ -0,0 +1 @@ +<%=KTZ4%> diff --git a/LastTDR/slot5.json b/LastTDR/slot5.json new file mode 100644 index 0000000..cf8ad88 --- /dev/null +++ b/LastTDR/slot5.json @@ -0,0 +1 @@ +<%=KTZ5%> diff --git a/LastTDR/slot6.json b/LastTDR/slot6.json new file mode 100644 index 0000000..c8a9730 --- /dev/null +++ b/LastTDR/slot6.json @@ -0,0 +1 @@ +<%=KTZ6%> diff --git a/LastTDR/slot7.json b/LastTDR/slot7.json new file mode 100644 index 0000000..3c44b9b --- /dev/null +++ b/LastTDR/slot7.json @@ -0,0 +1 @@ +<%=KTZ7%> diff --git a/LastTDR/slot8.json b/LastTDR/slot8.json new file mode 100644 index 0000000..756e50e --- /dev/null +++ b/LastTDR/slot8.json @@ -0,0 +1 @@ +<%=KTZ8%> diff --git a/LastTDR/slot9.json b/LastTDR/slot9.json new file mode 100644 index 0000000..18e7d0e --- /dev/null +++ b/LastTDR/slot9.json @@ -0,0 +1 @@ +<%=KTZ9%> diff --git a/components/modules/Kue705FO.jsx b/components/modules/Kue705FO.jsx index fa436ec..7c6fa84 100644 --- a/components/modules/Kue705FO.jsx +++ b/components/modules/Kue705FO.jsx @@ -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 = () => { diff --git a/public/LastTDR/slot0.json b/public/LastTDR/slot0.json new file mode 100644 index 0000000..98a8890 --- /dev/null +++ b/public/LastTDR/slot0.json @@ -0,0 +1 @@ +<%=KTZ0%> diff --git a/public/LastTDR/slot1.json b/public/LastTDR/slot1.json new file mode 100644 index 0000000..edd4b48 --- /dev/null +++ b/public/LastTDR/slot1.json @@ -0,0 +1 @@ +<%=KTZ1%> diff --git a/public/LastTDR/slot10.json b/public/LastTDR/slot10.json new file mode 100644 index 0000000..62cce0d --- /dev/null +++ b/public/LastTDR/slot10.json @@ -0,0 +1 @@ +<%=KTZ10%> diff --git a/public/LastTDR/slot11.json b/public/LastTDR/slot11.json new file mode 100644 index 0000000..92c8578 --- /dev/null +++ b/public/LastTDR/slot11.json @@ -0,0 +1 @@ +<%=KTZ11%> diff --git a/public/LastTDR/slot12.json b/public/LastTDR/slot12.json new file mode 100644 index 0000000..3085cff --- /dev/null +++ b/public/LastTDR/slot12.json @@ -0,0 +1 @@ +<%=KTZ12%> diff --git a/public/LastTDR/slot13.json b/public/LastTDR/slot13.json new file mode 100644 index 0000000..f48d821 --- /dev/null +++ b/public/LastTDR/slot13.json @@ -0,0 +1 @@ +<%=KTZ13%> diff --git a/public/LastTDR/slot14.json b/public/LastTDR/slot14.json new file mode 100644 index 0000000..9d6c4f1 --- /dev/null +++ b/public/LastTDR/slot14.json @@ -0,0 +1 @@ +<%=KTZ14%> diff --git a/public/LastTDR/slot15.json b/public/LastTDR/slot15.json new file mode 100644 index 0000000..fe2745f --- /dev/null +++ b/public/LastTDR/slot15.json @@ -0,0 +1 @@ +<%=KTZ15%> diff --git a/public/LastTDR/slot16.json b/public/LastTDR/slot16.json new file mode 100644 index 0000000..de0a2a6 --- /dev/null +++ b/public/LastTDR/slot16.json @@ -0,0 +1 @@ +<%=KTZ16%> diff --git a/public/LastTDR/slot17.json b/public/LastTDR/slot17.json new file mode 100644 index 0000000..54cf9e0 --- /dev/null +++ b/public/LastTDR/slot17.json @@ -0,0 +1 @@ +<%=KTZ17%> diff --git a/public/LastTDR/slot18.json b/public/LastTDR/slot18.json new file mode 100644 index 0000000..b163760 --- /dev/null +++ b/public/LastTDR/slot18.json @@ -0,0 +1 @@ +<%=KTZ18%> diff --git a/public/LastTDR/slot19.json b/public/LastTDR/slot19.json new file mode 100644 index 0000000..ba2cf5d --- /dev/null +++ b/public/LastTDR/slot19.json @@ -0,0 +1 @@ +<%=KTZ19%> diff --git a/public/LastTDR/slot2.json b/public/LastTDR/slot2.json new file mode 100644 index 0000000..edd4b48 --- /dev/null +++ b/public/LastTDR/slot2.json @@ -0,0 +1 @@ +<%=KTZ1%> diff --git a/public/LastTDR/slot20.json b/public/LastTDR/slot20.json new file mode 100644 index 0000000..7b0450e --- /dev/null +++ b/public/LastTDR/slot20.json @@ -0,0 +1 @@ +<%=KTZ20%> diff --git a/public/LastTDR/slot21.json b/public/LastTDR/slot21.json new file mode 100644 index 0000000..d8d90e4 --- /dev/null +++ b/public/LastTDR/slot21.json @@ -0,0 +1 @@ +<%=KTZ21%> diff --git a/public/LastTDR/slot22.json b/public/LastTDR/slot22.json new file mode 100644 index 0000000..cd7acf4 --- /dev/null +++ b/public/LastTDR/slot22.json @@ -0,0 +1 @@ +<%=KTZ22%> diff --git a/public/LastTDR/slot23.json b/public/LastTDR/slot23.json new file mode 100644 index 0000000..87d169c --- /dev/null +++ b/public/LastTDR/slot23.json @@ -0,0 +1 @@ +<%=KTZ23%> diff --git a/public/LastTDR/slot24.json b/public/LastTDR/slot24.json new file mode 100644 index 0000000..d0ddbdf --- /dev/null +++ b/public/LastTDR/slot24.json @@ -0,0 +1 @@ +<%=KTZ24%> diff --git a/public/LastTDR/slot25.json b/public/LastTDR/slot25.json new file mode 100644 index 0000000..a2d1a5d --- /dev/null +++ b/public/LastTDR/slot25.json @@ -0,0 +1 @@ +<%=KTZ25%> diff --git a/public/LastTDR/slot26.json b/public/LastTDR/slot26.json new file mode 100644 index 0000000..0c90afc --- /dev/null +++ b/public/LastTDR/slot26.json @@ -0,0 +1 @@ +<%=KTZ26%> diff --git a/public/LastTDR/slot27.json b/public/LastTDR/slot27.json new file mode 100644 index 0000000..38e5d5e --- /dev/null +++ b/public/LastTDR/slot27.json @@ -0,0 +1 @@ +<%=KTZ27%> diff --git a/public/LastTDR/slot28.json b/public/LastTDR/slot28.json new file mode 100644 index 0000000..31c5555 --- /dev/null +++ b/public/LastTDR/slot28.json @@ -0,0 +1 @@ +<%=KTZ28%> diff --git a/public/LastTDR/slot29.json b/public/LastTDR/slot29.json new file mode 100644 index 0000000..921d4ea --- /dev/null +++ b/public/LastTDR/slot29.json @@ -0,0 +1 @@ +<%=KTZ29%> diff --git a/public/LastTDR/slot3.json b/public/LastTDR/slot3.json new file mode 100644 index 0000000..3d5e2d7 --- /dev/null +++ b/public/LastTDR/slot3.json @@ -0,0 +1 @@ +<%=KTZ3%> diff --git a/public/LastTDR/slot30.json b/public/LastTDR/slot30.json new file mode 100644 index 0000000..9b85999 --- /dev/null +++ b/public/LastTDR/slot30.json @@ -0,0 +1 @@ +<%=KTZ30%> diff --git a/public/LastTDR/slot31.json b/public/LastTDR/slot31.json new file mode 100644 index 0000000..a154b35 --- /dev/null +++ b/public/LastTDR/slot31.json @@ -0,0 +1 @@ +<%=KTZ31%> diff --git a/public/LastTDR/slot4.json b/public/LastTDR/slot4.json new file mode 100644 index 0000000..cc7b198 --- /dev/null +++ b/public/LastTDR/slot4.json @@ -0,0 +1 @@ +<%=KTZ4%> diff --git a/public/LastTDR/slot5.json b/public/LastTDR/slot5.json new file mode 100644 index 0000000..cf8ad88 --- /dev/null +++ b/public/LastTDR/slot5.json @@ -0,0 +1 @@ +<%=KTZ5%> diff --git a/public/LastTDR/slot6.json b/public/LastTDR/slot6.json new file mode 100644 index 0000000..c8a9730 --- /dev/null +++ b/public/LastTDR/slot6.json @@ -0,0 +1 @@ +<%=KTZ6%> diff --git a/public/LastTDR/slot7.json b/public/LastTDR/slot7.json new file mode 100644 index 0000000..3c44b9b --- /dev/null +++ b/public/LastTDR/slot7.json @@ -0,0 +1 @@ +<%=KTZ7%> diff --git a/public/LastTDR/slot8.json b/public/LastTDR/slot8.json new file mode 100644 index 0000000..756e50e --- /dev/null +++ b/public/LastTDR/slot8.json @@ -0,0 +1 @@ +<%=KTZ8%> diff --git a/public/LastTDR/slot9.json b/public/LastTDR/slot9.json new file mode 100644 index 0000000..18e7d0e --- /dev/null +++ b/public/LastTDR/slot9.json @@ -0,0 +1 @@ +<%=KTZ9%>