From 94b40c9b676854235f1cb3214c3e2a277229da16 Mon Sep 17 00:00:00 2001 From: ISA Date: Fri, 21 Feb 2025 11:56:39 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20Uhrzeit=20in=20Chart-Tooltips=20hinzuge?= =?UTF-8?q?f=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Tooltip-Format geändert auf `dd.MM.yyyy HH:mm`, um Datum und Uhrzeit anzuzeigen - X-Achse zeigt weiterhin nur das Datum (`dd.MM.yyyy`), aber Tooltips enthalten auch die Uhrzeit - Tooltip `callbacks.label` angepasst, um Uhrzeit (`HH:mm`) bei Mouse-Hover zusätzlich anzuzeigen - Sicherstellung, dass alle Linien (i, a, m, g) die korrekte Uhrzeit im Tooltip anzeigen --- .../kue705FO/Charts/ChartSwitcher.tsx | 2 +- .../LoopMeasurementChart.tsx | 21 +++++++++++++------ config/webVersion.ts | 2 +- public/CPLmockData/kuesChartData/DIA0_3.json | 4 ++-- public/CPLmockData/kuesChartData/DIA0_4.json | 2 +- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/components/main/kabelueberwachung/kue705FO/Charts/ChartSwitcher.tsx b/components/main/kabelueberwachung/kue705FO/Charts/ChartSwitcher.tsx index b557e87..34b78ee 100644 --- a/components/main/kabelueberwachung/kue705FO/Charts/ChartSwitcher.tsx +++ b/components/main/kabelueberwachung/kue705FO/Charts/ChartSwitcher.tsx @@ -41,7 +41,7 @@ const ChartSwitcher: React.FC = ({ isOpen, onClose }) => { transform: "translate(-50%, -50%)", width: "100%", maxWidth: "70rem", - height: "50rem", + height: "35rem", padding: "1rem", }, }} diff --git a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx index 8b5d460..a394d14 100644 --- a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx +++ b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx @@ -113,8 +113,8 @@ const LoopMeasurementChart = () => { type: "time", time: { unit: "day", - tooltipFormat: "dd.MM.yyyy", - displayFormats: { day: "dd.MM.yyyy" }, + tooltipFormat: "dd.MM.yyyy HH:mm", // Ändert das Format für Tooltips (inkl. Uhrzeit) + displayFormats: { day: "dd.MM.yyyy" }, // Achse bleibt nur Datum }, title: { display: true, text: "Zeit (Datum)" }, min: new Date(vonDatum).getTime(), @@ -129,10 +129,19 @@ const LoopMeasurementChart = () => { plugins: { tooltip: { callbacks: { - label: (tooltipItem) => - `${tooltipItem.dataset.label}: ${tooltipItem.raw.y.toFixed( - 2 - )} kOhm`, + label: (tooltipItem) => { + const date = new Date(tooltipItem.raw.x); + const timeString = `${date + .getHours() + .toString() + .padStart(2, "0")}:${date + .getMinutes() + .toString() + .padStart(2, "0")}`; + return `${ + tooltipItem.dataset.label + }: ${tooltipItem.raw.y.toFixed(2)} kOhm `; + }, }, }, zoom: { diff --git a/config/webVersion.ts b/config/webVersion.ts index acc0af2..a1ef2d4 100644 --- a/config/webVersion.ts +++ b/config/webVersion.ts @@ -6,5 +6,5 @@ 2: Patch oder Hotfix (Bugfixes oder kleine Änderungen). */ -const webVersion = "1.6.79"; +const webVersion = "1.6.80"; export default webVersion; diff --git a/public/CPLmockData/kuesChartData/DIA0_3.json b/public/CPLmockData/kuesChartData/DIA0_3.json index 2067e11..5da00a5 100644 --- a/public/CPLmockData/kuesChartData/DIA0_3.json +++ b/public/CPLmockData/kuesChartData/DIA0_3.json @@ -1,5 +1,5 @@ [ - { "t": "2025-03-03 11:42:00", "m": 21.0, "v": 1, "i": 11.0, "a": 31.0 }, + { "t": "2025-03-03 11:42:02", "m": 21.0, "v": 1, "i": 11.0, "a": 31.0 }, { "t": "2025-03-02 11:45:00", "m": 31.0, "v": 1, "i": 11.0, "a": 51.0 }, { "t": "2025-03-01 11:48:00", "m": 21.0, "v": 1, "i": 11.0, "a": 71.0 }, { "t": "2025-02-28 11:51:00", "m": 51.0, "v": 1, "i": 11.0, "a": 61.0 }, @@ -16,5 +16,5 @@ { "t": "2025-02-17 12:24:00", "m": 20.0, "v": 1, "i": 18.0, "a": 51.0 }, { "t": "2025-02-16 12:27:00", "m": 11.0, "v": 1, "i": 10.0, "a": 31.0 }, { "t": "2025-02-15 12:30:00", "m": 11.0, "v": 1, "i": 5.0, "a": 41.0 }, - { "t": "2025-02-14 12:33:00", "m": 11.0, "v": 1, "i": 7.0, "a": 31.0 } + { "t": "2025-02-14 12:43:00", "m": 11.0, "v": 1, "i": 7.0, "a": 31.0 } ] diff --git a/public/CPLmockData/kuesChartData/DIA0_4.json b/public/CPLmockData/kuesChartData/DIA0_4.json index 1ee66cf..dafb3a8 100644 --- a/public/CPLmockData/kuesChartData/DIA0_4.json +++ b/public/CPLmockData/kuesChartData/DIA0_4.json @@ -16,5 +16,5 @@ { "t": "2025-02-16 12:24:00", "m": 20.0, "v": 1, "i": 10.0, "a": 51.0 }, { "t": "2025-02-15 12:27:00", "m": 11.0, "v": 1, "i": 10.0, "a": 31.0 }, { "t": "2025-02-15 12:30:00", "m": 11.0, "v": 1, "i": 5.0, "a": 41.0 }, - { "t": "2025-02-14 12:33:00", "m": 11.0, "v": 1, "i": 7.0, "a": 51.0 } + { "t": "2025-02-14 10:33:00", "m": 11.0, "v": 1, "i": 7.0, "a": 51.0 } ]