diff --git a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx index c24a8f0..30ec783 100644 --- a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx +++ b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx @@ -15,7 +15,7 @@ import { } from "recharts"; import { setBrushRange } from "../../../../../../redux/slices/brushSlice"; -const CustomTooltip = ({ active, payload, label }: any) => { +const CustomTooltip = ({ active, payload, label, unit }: any) => { if (active && payload && payload.length) { const messwertMax = payload.find( (p: any) => p.dataKey === "messwertMaximum" @@ -40,12 +40,12 @@ const CustomTooltip = ({ active, payload, label }: any) => { {new Date(label).toLocaleString()} {messwertMax && (
- Messwert Maximum: {messwertMax.value.toFixed(2)} kOhm + Messwert Maximum: {messwertMax.value.toFixed(2)} {unit}
)} {messwert && (
- Messwert: {messwert.value.toFixed(2)} kOhm + Messwert: {messwert.value.toFixed(2)} {unit}
)} {messwertDurchschnitt && ( @@ -53,12 +53,12 @@ const CustomTooltip = ({ active, payload, label }: any) => { style={{ color: "#00AEEF" }} >{`Messwert Durchschnitt: ${messwertDurchschnitt.value.toFixed( 2 - )} kOhm`} + )} ${unit}`} )} {messwertMin && (
{`Messwert Minimum: ${messwertMin.value.toFixed(2)} kOhm`}
+ >{`Messwert Minimum: ${messwertMin.value.toFixed(2)} ${unit}`} )} ); @@ -68,6 +68,9 @@ const CustomTooltip = ({ active, payload, label }: any) => { const LoopMeasurementChart = () => { const dispatch = useDispatch(); + const unit = useSelector( + (state: RootState) => state.kabelueberwachungChart.unit + ); const brushRange = useSelector((state: RootState) => state.brush); const { @@ -156,11 +159,11 @@ const LoopMeasurementChart = () => { tickFormatter={(zeit) => new Date(zeit).toLocaleDateString()} /> `${wert.toFixed(2)} kOhm`} + tickFormatter={(wert) => `${wert.toFixed(0)} `} /> - } /> + } /> ) => { state.selectedSlotType = action.payload; + state.unit = action.payload === "schleifenwiderstand" ? "kOhm" : "MOhm"; // 🆕 Einheit setzen }, // Aktion zum Öffnen oder Schließen des Charts setChartOpen: (state, action: PayloadAction) => {