Skip to content

fix(statistics): let a point on the 0 % or 100 % line draw in full - #166

Merged
luflow merged 1 commit into
mainfrom
claude/statistik-punkte-clipping
Aug 11, 2026
Merged

fix(statistics): let a point on the 0 % or 100 % line draw in full#166
luflow merged 1 commit into
mainfrom
claude/statistik-punkte-clipping

Conversation

@luflow

@luflow luflow commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Was war das Problem

Punkte im „Zeitlicher Verlauf"-Chart, die genau auf 0 % oder 100 % liegen, werden zur Hälfte abgeschnitten. Der Fix in af0d458 hat dafür layout.padding vergrößert — das hat nichts gebracht.

Warum der letzte Anlauf nicht wirken konnte

Die Annahme war, die Canvas-Kante schneide ab. Tatsächlich clippt chart.js ein Dataset an der Plot-Area, und layout.padding verschiebt genau diese Grenze mit nach innen. Der Punkt auf dem Achsenlimit verliert seine äußere Hälfte danach also unverändert. Der chart.js-Default für clip ist borderWidth / 2 — daher der 1-px-Splitter, der übrig bleibt.

Nachgemessen auf der Produktivinstanz (Canvas-Pixel, DPR 2):

  • 100 %-Gitterlinie: Gerätezeile 91/92
  • oberster Pixel des Punkts: Zeile 92, mit flacher Kante
  • Zeilen 85–91 komplett weiß — das Padding hatte dort Platz geschaffen, der ungenutzt blieb

Ein Punkt mit Radius 3 müsste bei 85,5 beginnen.

Was sich ändert

  • clip: POINT_OVERFLOW auf dem Line-Dataset, damit der Punkt in das reservierte Padding hineinzeichnen darf
  • layout.padding jetzt gleichmäßig auf demselben Wert; unten und links standen auf 4 und lagen damit unter dem Hover-Radius von 5

Die Bar-Charts bleiben auf dem Default — ein Balken endet ohnehin an der Kante.

Verifikation

Isolierte Repro-Seite mit der chart.js-Version aus dem Repo, alte und neue Optionen nebeneinander:

chartArea.top oberster Punkt-Pixel
vorher 92 92 — abgeschnitten
nachher 92 84 — voller Radius

Gleiches Bild an der 0 %-Kante. eslint und npm run build sind grün.

Für den Review

Rein visuell, keine API- oder Verhaltensänderung — für den Flutter-Client irrelevant.

The previous attempt grew `layout.padding`, on the assumption the canvas edge
was doing the clipping. It is not: chart.js clips a dataset at the plot area,
and `layout.padding` moves that boundary inwards along with everything else, so
a point sitting exactly on the axis limit kept losing its outer half.

Measured on the live page: the 100 % gridline sits at device row 92, the
topmost pixel of the point is also at row 92 with a flat edge, and the eight
rows of padding above it stay empty. A radius-3 point would have to start at
85,5.

Setting `clip` on the line dataset lets the point spill into that padding.
Padding is now uniform, because bottom and left were at 4 — below the hover
radius of 5.
@luflow
luflow merged commit 85a1f76 into main Aug 11, 2026
3 checks passed
@luflow
luflow deleted the claude/statistik-punkte-clipping branch August 11, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant