From 0d1355457bc735315fe8f5631e4ef95d3c24377c Mon Sep 17 00:00:00 2001 From: ISA Date: Fri, 14 Feb 2025 11:43:17 +0100 Subject: [PATCH] Schleifenmessung von Mock->Redux --- .../LoopMeasurementChart.tsx | 24 +++++-------------- config/webVersion.ts | 2 +- public/mockData.json | 17 +++++++------ 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx index 3c3f9eb..077cd11 100644 --- a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx +++ b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx @@ -1,26 +1,14 @@ import React, { useEffect, useRef } from "react"; import { useSelector } from "react-redux"; -import { RootState } from "../../../../../../redux/store"; import Chart from "chart.js/auto"; import "chartjs-adapter-moment"; -const LoopMeasurementChart: React.FC = () => { - const chartRef = useRef(null); - const chartInstance = useRef(null); +const LoopMeasurementChart = () => { + const chartRef = useRef(null); + const chartInstance = useRef(null); - // Mock-Daten für das Beispiel - const chartData = [ - { t: "14-02-2025 10:00:00", i: 3.116, a: 3.116, g: 3.116 }, - { t: "14-02-2025 09:00:00", i: 8.116, a: 3.116, g: 15.116 }, - { t: "14-02-2025 08:00:00", i: 3.116, a: 3.116, g: 3.116 }, - { t: "13-02-2025 15:00:00", i: 9.116, a: 21.0, g: 65.0 }, - { t: "13-02-2025 14:00:00", i: 65.0, a: 65.0, g: 65.0 }, - { t: "13-02-2025 13:00:00", i: 65.0, a: 65.0, g: 65.0 }, - { t: "13-02-2025 12:00:00", i: 65.0, a: 65.0, g: 65.0 }, - { t: "13-02-2025 11:00:00", i: 65.0, a: 65.0, g: 65.0 }, - { t: "13-02-2025 10:00:00", i: 65.0, a: 65.0, g: 65.0 }, - { t: "13-02-2025 09:00:00", i: 50.0, a: 30.0, g: 25.0 }, - ]; + // Daten aus dem Redux-Store abrufen + const chartData = useSelector((state) => state.chartData.data) ?? []; useEffect(() => { if (chartRef.current) { @@ -112,7 +100,7 @@ const LoopMeasurementChart: React.FC = () => { chartInstance.current = null; } }; - }, []); + }, [chartData]); return (
diff --git a/config/webVersion.ts b/config/webVersion.ts index 1051972..418eabe 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.46"; +const webVersion = "1.6.47"; export default webVersion; diff --git a/public/mockData.json b/public/mockData.json index fb5dc8c..46ca41a 100644 --- a/public/mockData.json +++ b/public/mockData.json @@ -1,9 +1,12 @@ [ - { "t": "13-02-2025 15:00:00", "i": 60.0, "a": 65.0, "g": 70.0 }, - { "t": "14-02-2025 14:00:00", "i": 65.0, "a": 65.0, "g": 65.0 }, - { "t": "14-02-2025 13:00:00", "i": 65.0, "a": 65.0, "g": 65.0 }, - { "t": "15-02-2025 12:00:00", "i": 65.0, "a": 65.0, "g": 65.0 }, - { "t": "15-02-2025 11:00:00", "i": 65.0, "a": 65.0, "g": 65.0 }, - { "t": "16-02-2025 10:00:00", "i": 65.0, "a": 65.0, "g": 65.0 }, - { "t": "17-02-2025 09:00:00", "i": 65.0, "a": 65.0, "g": 65.0 } + { "t": "14-02-2025 10:00:00", "i": 10.116, "a": 3.116, "g": 3.116 }, + { "t": "14-02-2025 09:00:00", "i": 3.116, "a": 8.116, "g": 3.116 }, + { "t": "14-02-2025 08:00:00", "i": 3.116, "a": 3.116, "g": 25.116 }, + { "t": "13-02-2025 15:00:00", "i": 5.0, "a": 65.0, "g": 65.0 }, + { "t": "13-02-2025 14:00:00", "i": 65.0, "a": 6.0, "g": 65.0 }, + { "t": "13-02-2025 13:00:00", "i": 65.0, "a": 65.0, "g": 70.0 }, + { "t": "13-02-2025 12:00:00", "i": 65.0, "a": 65.0, "g": 65.0 }, + { "t": "13-02-2025 11:00:00", "i": 65.0, "a": 65.0, "g": 65.0 }, + { "t": "13-02-2025 10:00:00", "i": 65.0, "a": 65.0, "g": 65.0 }, + { "t": "13-02-2025 09:00:00", "i": 65.0, "a": 65.0, "g": 65.0 } ]