feat: Brush-Achsenbeschriftung auf Datumsformat umgestellt
- 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.
This commit is contained in:
@@ -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
|
||||
/>
|
||||
</ComposedChart>
|
||||
</ResponsiveContainer>
|
||||
|
||||
Reference in New Issue
Block a user