prohand
4. September 2026 um 11:16
1
Hallo,
Ich habe ein Problem mit der Anzeige der Steckdosenleistung festgestellt.
Wie in den beigefügten Screenshots zu sehen ist, ändern sich das Diagramm und die Verbrauchswerte, manchmal deutlich, aber die angezeigte Variation bleibt systematisch bei +47,50 % hängen.
Zum Beispiel sind die Verbrauchsprofile in den Screenshots sehr unterschiedlich, während der Variationsindikator sich nie ändert.
Erwartetes Verhalten: Die prozentuale Variation sollte neu berechnet und basierend auf den angezeigten Daten aktualisiert werden.
Beobachtetes Verhalten: Der Wert bleibt bei +47,50 % , unabhängig von der Entwicklung des Diagramms.
Beispiel mit der Kühlschrank-Steckdose allein, die 95% anzeigt, aber darüber immer noch 47,50%:
Es wäre vielleicht sinnvoll, eine Option zu haben, um den Wert in W und die prozentuale Variation zu entkoppeln, da « Variation anzeigen » die beiden Werte verschwinden lässt und in meinem Fall nur die prozentuale Variation relevant wäre.
Danke
Hallo zusammen!
Dieses Thema ist nun in Entwicklung .
Ein Pull Request wurde eröffnet, damit die Überschrift des Grafik-Widgets den in der Legende sichtbaren Serien folgt:
master ← claude/bug-affichage-variation-nbk3fh
ouvert 11:28AM - 04 Sep 26 UTC
### Description
On a chart box with several devices and "display variation" ena… bled, the value and the variation shown above the chart were computed on **all** the devices of the box. Hiding a device through the chart legend changed the curves but never the numbers.
That is what the forum user saw on their "Puissance prises" box (washing machine + fridge): the header always showed `43.13 W +47.50%`, i.e. the average of the last values `(0 + 86.25) / 2` and the average of the per-device variations `(0% + 95%) / 2`, whatever was toggled in the legend.
What changes:
- **The header follows the legend.** Each time the chart is drawn (ApexCharts `mounted` and `updated` events, which a legend toggle goes through), `ApexChartComponent` reports the series the chart has actually collapsed (`collapsedSeriesIndices` + `ancillaryCollapsedSeriesIndices`) to `Chart`, which recomputes the last value and the variation from the visible series only. Hiding the washing machine shows the fridge alone (`86.25 W +95%`), showing it again goes back to the average of both. Reading the state of the chart rather than mirroring the clicks keeps the header right whatever ApexCharts did with a click.
- **Hidden series stay hidden while browsing periods.** ApexCharts keeps collapsed series when only the data is refreshed (`updateOptions`), and the header follows since it is fed by the chart itself. A recreated chart shows all its series, and so does the header. Hiding every series empties the header instead of showing stale numbers.
- **The chart is recreated when the devices of the box change** (`key` on `ApexChartComponent` built from `box.device_features`): the hidden series are positional, so this avoids keeping hiding an index that now points to another device, in the chart as in the header.
- **The variation is the variation of the averaged value**, not the average of the per-device variations, so the two numbers of the header describe the same quantity ("the average of the visible devices is now X, Y% more than at the start of the period"). It also avoids a device starting the period at `0` turning the whole variation into `Infinity`. In the case above the box now shows `43.13 W +95%` with both devices visible.
- The first/last values are now converted (miles/°F preferences) on the aggregated value (`min`/`max`/`sum`…) rather than only on `value`, which was a small pre-existing inconsistency.
Verified in demo mode (`npm run start-demo`, with `display_axes` temporarily enabled on the "Production and consumption" box) using Playwright: hide series A → header shows series B only, show A again → back to the average, hide B → series A only, previous period → B stays hidden in the chart and the header shows A only, hide both → empty header.
| both visible | solar inverter hidden | previous period, electric meter hidden |
|---|---|---|
| `2199 W -23%` | `1500 W -25%` | `3996 W +48%` |
## Forum
Forum: https://community.gladysassistant.com/t/bug-d-affichage-la-variation-en-ne-se-met-pas-a-jour/10797
### Checklist
- [x] Tests pass: front-only change, no server code touched; Cypress has no chart-box spec, the behaviour was verified manually in demo mode with Playwright (see above)
- [x] Linter and prettier pass on both front and server (`npm run eslint`, `npm run prettier`)
- [x] No undocumented breaking change
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01HrXCc7YmGQP6o97Evz8ttc
## Summary by CodeRabbit
* **Bug Fixes**
* Chart event handling now preserves existing chart behaviors while tracking hidden series.
* Chart summary values now update correctly when series are hidden or shown through the legend.
* Hidden-series tracking now remains accurate when multiple series are collapsed.
* Charts refresh correctly when configured device features change, including legacy single-device configurations.
* Existing timeline chart styling and other configured chart interactions continue to work alongside hidden-series updates.
Zögert nicht, den PR zu verfolgen, zu testen (optional, besonders bei kleinen Anfragen) und euer Feedback hier zu hinterlassen, falls nötig.