Batteriespannungs-Diagramm: feste 170px-Höhe statt aspect-ratio, Y-Achse geklemmt

Die aspect-ratio-Lösung für die volle Spaltenbreite ließ auf großen Bildschirmen
die gesamte Koordinatenfläche mitwachsen - Achsenbeschriftungen (fester font-size
in SVG-Einheiten) wurden dadurch auf ~26px zu groß, das Diagramm unnötig hoch.
Zurück auf eine feste 170px-Höhe: der Y-Maßstab bleibt immer 1:1, nur die
X-Achse dehnt sich auf die volle Breite - normale Schriftgröße, kompaktes
Diagramm, trotzdem volle Spaltenbreite.

bvSkalaY()/y() klemmen jetzt auf [0,1] statt roh zu extrapolieren - ein Punkt
außerhalb von yMin/yMax (z. B. ein Ausreißer auf einer noch nicht aktualisierten
Instanz) zeichnet sich sonst weit außerhalb der Fläche und reißt die Linie über
den Rand hinaus, statt sichtbar am Achsenrand zu liegen.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
2026-08-27 18:33:31 +02:00
co-authored by Claude Sonnet 5
parent b8e560e75b
commit cf57c5f1a5
7 changed files with 61 additions and 14 deletions
+33
View File
@@ -3234,6 +3234,39 @@ interact with there); `batterie.py` re-`py_compile`d clean after the floor chang
restart confirmed clean via log at every step (single `audi_dashboard` loader warning each time, no
duplicate-domain regression).
**Third follow-up (2026.8.27.5): a real regression from the `.1` width fix, plus a robustness gap, both
found from an owner screenshot of the wide-screen chart.** (1) **"Numbers are too large" / "reduce the
height"** - the `.1` fix (aspect-ratio matching the 320:170 viewBox so height scales with width) meant the
whole coordinate system, axis text included, scaled up together: at the full ~772px column width the SVG's
Y-scale grew to ~2.4×, so the `font-size="11"` axis labels rendered at ~26px and the chart itself grew to
~410px tall - both regressions from the same root cause, not two separate bugs. Reverted to a **fixed pixel
height** (`height:${BV_H}px` = 170px, dropping `aspect-ratio` entirely) with `width:100%` unchanged - the
Y-scale is now always exactly 1:1 regardless of container width, so axis text stays a normal ~11px and the
chart stays a compact, constant 170px tall on any screen; only the X-axis stretches to fill the column,
which is exactly the wide-and-short shape the owner asked for. companion-app's `Verlaufsdiagramm` never had
this bug (`.dm-diagramm` already used a fixed `height:120px` with no SVG-embedded text) - nothing to fix
there, confirmed by inspection.
(2) **"0V is being respected on the real instance - why isn't it ignored?"** - the screenshot showed a data
point plotted **below the axis's bottom edge**, past the 10V gridline, and a `0,0 V` SOC readout. Two
different things bundled in that one report: the underlying data point is almost certainly a pre-`.4`
reading (the same class of stale-data issue as `.2` item 1 above) sitting in the **real instance's**
`batteriespannung.jsonl` from before that instance was updated to run the raised `SPANNUNG_MIN_V=10.0` floor
- this session only ever touched `audi_ha_test`, never the owner's real instance, so nothing here confirms
the real instance is even running `.4`/`.5` yet (needs the self-update button + restart, or `install.ps1`,
plus a swipe-delete of the offending day exactly like `.2` item 1). Separately, and fixed here regardless of
that: **`bvSkalaY()` never clamped its output** - a point outside `[yMin, yMax]` (whatever the reason: a
stale reading, a not-yet-updated instance, a future edge case) extrapolated linearly past the plot area
instead of pinning to the axis edge, which is what actually drew the line running off the bottom of the
chart in the screenshot. Clamped the fraction to `[0, 1]` before scaling, in both codebases (companion-app's
equivalent `y()` in `Verlaufsdiagramm` got the identical clamp, for the same reason - it had no text-scaling
bug but shared this gap). This is a defensive rendering fix, not a data fix - it stops a bad point from
visually breaking the chart, but the owner's real instance still needs updating and the stale entry still
needs deleting for the *readout* (SOC/current-value tiles) to stop showing 0V too. Verified live: SVG
measured 736×170px at a 1400px viewport (Y-scale exactly `1`), axis label `getComputedStyle` font-size
`11px`, screenshot confirmed normal-sized labels and a compact chart using the full column. companion-app:
`tsc --noEmit` clean. Manifest bumped to `2026.8.27.5`, `npm run ota` rerun, `audi_ha_test` restart confirmed
clean via log.
---
## Working conventions (observed — keep them)