From 8ca3318181e3948d9618d1435b365c834d0e1d47 Mon Sep 17 00:00:00 2001 From: ISA Date: Thu, 13 Mar 2025 07:03:40 +0100 Subject: [PATCH] feat: Brush-Achsenbeschriftung auf Datumsformat umgestellt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - TickFormatter für Brush angepasst, sodass anstelle von Unix-Timestamps jetzt das formatierte Datum (TT.MM.JJJJ) angezeigt wird. - Redux-Brush-Slice um `startDate` und `endDate` erweitert, um die Auswahlbereiche mit Datum statt Indizes zu speichern. - Brush-Event-Handler (`handleBrushChange`) aktualisiert, sodass Start- und Enddatum beim Verschieben im Redux-Store gespeichert werden. --- .../LoopMeasurementChart.tsx | 16 ++++++++++++++-- config/webVersion.ts | 2 +- redux/slices/brushSlice.ts | 4 ++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx index 82ac7a6..c99f5d2 100644 --- a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx +++ b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx @@ -108,9 +108,20 @@ const LoopMeasurementChart = () => { const handleBrushChange = useCallback( ({ startIndex, endIndex }) => { - dispatch(setBrushRange({ startIndex, endIndex })); + dispatch( + setBrushRange({ + startIndex, + endIndex, + startDate: new Date(formatierteDaten[startIndex].zeit) + .toISOString() + .split("T")[0], + endDate: new Date(formatierteDaten[endIndex].zeit) + .toISOString() + .split("T")[0], + }) + ); }, - [dispatch] + [dispatch, formatierteDaten] ); return ( @@ -160,6 +171,7 @@ const LoopMeasurementChart = () => { onChange={handleBrushChange} startIndex={brushRange.startIndex} endIndex={brushRange.endIndex || formatierteDaten.length - 1} + tickFormatter={(zeit) => new Date(zeit).toLocaleDateString()} // Datum statt Zahl /> diff --git a/config/webVersion.ts b/config/webVersion.ts index 69cda3d..84a139f 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.120"; +const webVersion = "1.6.121"; export default webVersion; diff --git a/redux/slices/brushSlice.ts b/redux/slices/brushSlice.ts index c43b02c..0ee2e3b 100644 --- a/redux/slices/brushSlice.ts +++ b/redux/slices/brushSlice.ts @@ -6,11 +6,15 @@ const brushSlice = createSlice({ initialState: { startIndex: 0, endIndex: 0, + startDate: null, + endDate: null, }, reducers: { setBrushRange(state, action) { state.startIndex = action.payload.startIndex; state.endIndex = action.payload.endIndex; + state.startDate = action.payload.startDate || state.startDate; + state.endDate = action.payload.endDate || state.endDate; }, }, });