From f876bef7a30f649bdf73722a3e62f9edbc830878 Mon Sep 17 00:00:00 2001 From: ISA Date: Mon, 21 Jul 2025 10:32:01 +0200 Subject: [PATCH] feat(analogInputsChart): dynamische Linien je Zeitraum (m/i/a/g) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Chart zeigt für 'Alle Messwerte' (DIA0) Messwert (m), Minimum (i), Maximum (a) - Für 'Stündlich' und 'Täglich' (DIA1/DIA2) werden Minimum (i), Maximum (a), Durchschnitt (g) angezeigt - Farben und Legende entsprechend --- .env.development | 2 +- .env.production | 2 +- CHANGELOG.md | 18 +++ .../main/analogInputs/AnalogInputsChart.tsx | 123 ++++++++++++------ package-lock.json | 4 +- package.json | 2 +- 6 files changed, 104 insertions(+), 47 deletions(-) diff --git a/.env.development b/.env.development index 08eae02..b0900eb 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.608 +NEXT_PUBLIC_APP_VERSION=1.6.610 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 66e19d4..b8da8d7 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.608 +NEXT_PUBLIC_APP_VERSION=1.6.610 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6faf36b..fb8942e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +## [1.6.610] – 2025-07-21 + +- feat(analogInputsChart): zeige Minimum (i) und Maximum (a) als zusätzliche Linien im Chart + +- Chart zeigt jetzt Messwert (m), Minimum (i, grün) und Maximum (a, rot) für ausgewählten Zeitraum +- Tooltip und Legende angepasst +- Typdefinitionen für Chart + +--- +## [1.6.609] – 2025-07-21 + +- feat(analogInputsChart): zeige Minimum (i) und Maximum (a) als zusätzliche Linien im Chart + +- Chart zeigt jetzt Messwert (m), Minimum (i, grün) und Maximum (a, rot) für ausgewählten Zeitraum +- Tooltip und Legende angepasst +- Typdefinitionen für Chart + +--- ## [1.6.608] – 2025-07-21 - feat(analogInputsChart): zeige Minimum (i) und Maximum (a) als zusätzliche Linien im Chart diff --git a/components/main/analogInputs/AnalogInputsChart.tsx b/components/main/analogInputs/AnalogInputsChart.tsx index 828aa0a..8ed6f2b 100644 --- a/components/main/analogInputs/AnalogInputsChart.tsx +++ b/components/main/analogInputs/AnalogInputsChart.tsx @@ -42,9 +42,10 @@ ChartJS.register( type AnalogInputHistoryPoint = { t: string; - m: number; + m?: number; i?: number; a?: number; + g?: number; }; export default function AnalogInputsChart() { @@ -177,47 +178,85 @@ export default function AnalogInputsChart() { const chartData = { datasets: filteredPoints.length > 0 - ? [ - { - label: selectedAnalogInput?.label - ? `Messwert (m) ${selectedAnalogInput.label}` - : "Messwert (m)", - data: filteredData.map((point) => ({ - x: new Date(point.t), - y: point.m, - })), - fill: false, - borderColor: getColor("littwin-blue"), - backgroundColor: "rgba(59,130,246,0.3)", - borderWidth: 2, - pointRadius: 0, - tension: 0.1, - }, - { - label: "Minimum (i)", - data: filteredData - .filter((point) => typeof point.i === "number") - .map((point) => ({ x: new Date(point.t), y: point.i })), - fill: false, - borderColor: "#22c55e", // grün - borderWidth: 1, - pointRadius: 0, - borderDash: [4, 2], - tension: 0.1, - }, - { - label: "Maximum (a)", - data: filteredData - .filter((point) => typeof point.a === "number") - .map((point) => ({ x: new Date(point.t), y: point.a })), - fill: false, - borderColor: "#ef4444", // rot - borderWidth: 1, - pointRadius: 0, - borderDash: [4, 2], - tension: 0.1, - }, - ] + ? zeitraum === "DIA0" + ? [ + { + label: selectedAnalogInput?.label + ? `Messwert (m) ${selectedAnalogInput.label}` + : "Messwert (m)", + data: filteredData + .filter((point) => typeof point.m === "number") + .map((point) => ({ x: new Date(point.t), y: point.m })), + fill: false, + borderColor: getColor("littwin-blue"), + backgroundColor: "rgba(59,130,246,0.3)", + borderWidth: 2, + pointRadius: 0, + tension: 0.1, + }, + { + label: "Minimum (i)", + data: filteredData + .filter((point) => typeof point.i === "number") + .map((point) => ({ x: new Date(point.t), y: point.i })), + fill: false, + borderColor: "#22c55e", // grün + borderWidth: 1, + pointRadius: 0, + borderDash: [4, 2], + tension: 0.1, + }, + { + label: "Maximum (a)", + data: filteredData + .filter((point) => typeof point.a === "number") + .map((point) => ({ x: new Date(point.t), y: point.a })), + fill: false, + borderColor: "#ef4444", // rot + borderWidth: 1, + pointRadius: 0, + borderDash: [4, 2], + tension: 0.1, + }, + ] + : [ + { + label: "Minimum (i)", + data: filteredData + .filter((point) => typeof point.i === "number") + .map((point) => ({ x: new Date(point.t), y: point.i })), + fill: false, + borderColor: "#22c55e", // grün + borderWidth: 1, + pointRadius: 0, + borderDash: [4, 2], + tension: 0.1, + }, + { + label: "Maximum (a)", + data: filteredData + .filter((point) => typeof point.a === "number") + .map((point) => ({ x: new Date(point.t), y: point.a })), + fill: false, + borderColor: "#ef4444", // rot + borderWidth: 1, + pointRadius: 0, + borderDash: [4, 2], + tension: 0.1, + }, + { + label: "Durchschnitt (g)", + data: filteredData + .filter((point) => typeof point.g === "number") + .map((point) => ({ x: new Date(point.t), y: point.g })), + fill: false, + borderColor: "#6366f1", // indigo + borderWidth: 1, + pointRadius: 0, + borderDash: [2, 2], + tension: 0.1, + }, + ] : [], }; diff --git a/package-lock.json b/package-lock.json index 9f58d1c..ed9da31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cpl-v4", - "version": "1.6.608", + "version": "1.6.610", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cpl-v4", - "version": "1.6.608", + "version": "1.6.610", "dependencies": { "@fontsource/roboto": "^5.1.0", "@headlessui/react": "^2.2.4", diff --git a/package.json b/package.json index 7c3f73b..6ba959e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.608", + "version": "1.6.610", "private": true, "scripts": { "dev": "next dev",