feat(chart): X-Achsen-Labels optimiert für bessere Lesbarkeit

- Jahreszahl aus der X-Achse entfernt, um die Darstellung kompakter zu machen.
- Datumsformat von `TT.MM.YYYY` auf `TT.MM` geändert.
- Achsenbeschriftung um 25° gedreht (`angle: -25`) für bessere Übersicht.
- `dy: 5` hinzugefügt, um die Abstände der Labels anzupassen.
This commit is contained in:
Ismail Ali
2025-03-15 11:42:17 +01:00
parent e0379c24a6
commit da28d64f8c
10 changed files with 22 additions and 12 deletions

View File

@@ -11,6 +11,7 @@ import {
setSelectedSlotType,
setChartOpen,
} from "../../../../../../redux/slices/kabelueberwachungChartSlice";
import { setBrushRange } from "../../../../../../redux/slices/brushSlice";
const LoopChartActionBar: React.FC = () => {
const dispatch = useDispatch();
@@ -157,11 +158,12 @@ const LoopChartActionBar: React.FC = () => {
<select
value={selectedMode}
onChange={(e) =>
onChange={(e) => {
dispatch(
setSelectedMode(e.target.value as "DIA0" | "DIA1" | "DIA2")
)
}
);
dispatch(setBrushRange({ startIndex: 0, endIndex: 0 })); // Zurücksetzen
}}
className="px-3 py-1 bg-white border rounded text-sm"
>
<option value="DIA0">Alle Messwerte</option>

View File

@@ -179,8 +179,13 @@ const LoopMeasurementChart = () => {
<XAxis
dataKey="zeit"
domain={["dataMin", "dataMax"]}
tickFormatter={(zeit) => new Date(zeit).toLocaleDateString()}
tickFormatter={(zeit) => {
const date = new Date(zeit);
return `${date.getDate()}.${date.getMonth() + 1}`;
}}
tick={{ angle: -25, dy: 5 }} // Dreht die Labels für bessere Übersicht
/>
<YAxis
label={{ value: unit, angle: -90, position: "insideLeft" }}
domain={["auto", "auto"]}