Bonjour,
J’ai constaté un problème sur l’affichage de la puissance des prises .
Comme visible sur les captures en pièce jointe, le graphique et les valeurs de consommation évoluent, parfois de façon importante, mais la variation affichée reste systématiquement bloquée à +47,50 % .
Par exemple, selon les captures, le profil de consommation est très différent, alors que l’indicateur de variation ne change jamais.
Comportement attendu : la variation en pourcentage devrait être recalculée et mise à jour en fonction des données affichées.
Comportement constaté : la valeur reste à +47,50 % , indépendamment de l’évolution du graphique.
Exemple avec la prise frigo seul qui indique 95% mais au dessus toujours 47,50% :
Il serait peut-être pertinant d’avoir une option pour décoreler la valeur en W et le pourcentage de variation car "Afficher la variation fais disparaitre les 2 valeurs et dans mon cas juste avoir la variation en pourcentage serait pertinent.
Merci
Salut tout le monde !
Ce sujet est désormais en cours de développement .
Une PR a été ouverte pour que l’en-tête du widget graphique suive les séries visibles dans la légende :
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.** `ApexChartComponent` now forwards the ApexCharts `legendClick` event to `Chart`, which keeps the list of hidden series and 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.
- **Hidden series stay hidden while browsing periods.** ApexCharts keeps collapsed series when only the data is refreshed (`updateOptions`), so the hidden list is kept across data refreshes too, and it is reset when the chart instance is recreated (a new chart shows all its series). Hiding every series empties the header instead of showing stale numbers.
- **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 |
|---|---|---|
| `2027 W -28%` | `1414 W -27%` | `3656 W +35%` |
## 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
---
_Generated by [Claude Code](https://claude.ai/code/session_01HrXCc7YmGQP6o97Evz8ttc)_
## Summary by CodeRabbit
- **Enhancements**
- Chart summary values now recalculate based on the series currently visible in the legend.
- Last values and variations are calculated from summarized data across visible series for more accurate chart headers.
- Chart summaries reset appropriately when the chart is recreated or refreshed.
- Legend interactions now update the displayed chart summary automatically.
N’hésitez pas à suivre la PR, à tester (optionnel, surtout pour les petites demandes) et à faire vos retours ici si besoin.