From 36863d3c6a45f153b235f841be8337ab7e30cf23 Mon Sep 17 00:00:00 2001 From: ISA Date: Wed, 23 Jul 2025 08:07:12 +0200 Subject: [PATCH] refactor: order Minimum, Messwert und Maximum, sowie Durchschnitt --- .env.development | 2 +- .env.production | 2 +- CHANGELOG.md | 8 +++ .../main/analogInputs/AnalogInputsChart.tsx | 57 ++++++++++--------- package-lock.json | 4 +- package.json | 2 +- 6 files changed, 42 insertions(+), 33 deletions(-) diff --git a/.env.development b/.env.development index 6a06536..e0c5dd5 100644 --- a/.env.development +++ b/.env.development @@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false NEXT_PUBLIC_EXPORT_STATIC=false NEXT_PUBLIC_USE_CGI=false # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.631 +NEXT_PUBLIC_APP_VERSION=1.6.632 NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter) diff --git a/.env.production b/.env.production index 16cc69c..3059689 100644 --- a/.env.production +++ b/.env.production @@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL NEXT_PUBLIC_EXPORT_STATIC=true NEXT_PUBLIC_USE_CGI=true # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.631 +NEXT_PUBLIC_APP_VERSION=1.6.632 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 77ea498..fdc0891 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## [1.6.632] – 2025-07-23 + +- feat(analogInputs): auto-load chart data when table row is selected + +- Added useEffect to AnalogInputsChart to automatically trigger "Daten laden" when a row is selected and selectedAnalogInput.id is not 0. +- Improves UX by syncing table selection with chart data fetch, no manual + +--- ## [1.6.631] – 2025-07-22 - Fix: Always show vonDatum and bisDatum in fetch URL for analog inputs chart diff --git a/components/main/analogInputs/AnalogInputsChart.tsx b/components/main/analogInputs/AnalogInputsChart.tsx index 552b522..5342242 100644 --- a/components/main/analogInputs/AnalogInputsChart.tsx +++ b/components/main/analogInputs/AnalogInputsChart.tsx @@ -185,20 +185,7 @@ export default function AnalogInputsChart() { ? zeitraum === "DIA0" ? [ { - label: selectedAnalogInput?.label - ? `Messwert (m) ${selectedAnalogInput.label}` - : "Messwert (m)", - data: filteredData - .filter((p) => typeof p.m === "number") - .map((p) => ({ x: new Date(p.t), y: p.m })), - borderColor: getColor("littwin-blue"), - backgroundColor: "rgba(59,130,246,0.3)", - borderWidth: 2, - pointRadius: 0, - tension: 0.1, - }, - { - label: "Minimum (i)", + label: "Minimum ", // (i) data: filteredData .filter((p) => typeof p.i === "number") .map((p) => ({ x: new Date(p.t), y: p.i })), @@ -209,7 +196,21 @@ export default function AnalogInputsChart() { tension: 0.1, }, { - label: "Maximum (a)", + label: selectedAnalogInput?.label + ? //? `Messwert ${selectedAnalogInput.label}` // (m) + `Messwert ` // (m) + : "Messwert ", // (m) + data: filteredData + .filter((p) => typeof p.m === "number") + .map((p) => ({ x: new Date(p.t), y: p.m })), + borderColor: getColor("littwin-blue"), + backgroundColor: "rgba(59,130,246,0.3)", + borderWidth: 2, + pointRadius: 0, + tension: 0.1, + }, + { + label: "Maximum ", // (a) data: filteredData .filter((p) => typeof p.a === "number") .map((p) => ({ x: new Date(p.t), y: p.a })), @@ -222,7 +223,7 @@ export default function AnalogInputsChart() { ] : [ { - label: "Minimum (i)", + label: "Minimum", // (i) data: filteredData .filter((p) => typeof p.i === "number") .map((p) => ({ x: new Date(p.t), y: p.i })), @@ -233,18 +234,7 @@ export default function AnalogInputsChart() { tension: 0.1, }, { - label: "Maximum (a)", - data: filteredData - .filter((p) => typeof p.a === "number") - .map((p) => ({ x: new Date(p.t), y: p.a })), - borderColor: "gray", - borderDash: [4, 2], - borderWidth: 1, - pointRadius: 0, - tension: 0.1, - }, - { - label: "Durchschnitt (g)", + label: "Durchschnitt", // (g) data: filteredData .filter((p) => typeof p.g === "number") .map((p) => ({ x: new Date(p.t), y: p.g })), @@ -254,6 +244,17 @@ export default function AnalogInputsChart() { pointRadius: 0, tension: 0.1, }, + { + label: "Maximum", // (a) + data: filteredData + .filter((p) => typeof p.a === "number") + .map((p) => ({ x: new Date(p.t), y: p.a })), + borderColor: "gray", + borderDash: [4, 2], + borderWidth: 1, + pointRadius: 0, + tension: 0.1, + }, ] : [], }; diff --git a/package-lock.json b/package-lock.json index 77b6d08..fdc50df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cpl-v4", - "version": "1.6.631", + "version": "1.6.632", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cpl-v4", - "version": "1.6.631", + "version": "1.6.632", "dependencies": { "@fontsource/roboto": "^5.1.0", "@headlessui/react": "^2.2.4", diff --git a/package.json b/package.json index d0fdf1c..2b185a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.631", + "version": "1.6.632", "private": true, "scripts": { "dev": "next dev",