Skip to content

Match stepped interpolation to the rendered line path - #12370

Open
hakarrr wants to merge 4 commits into
chartjs:masterfrom
hakarrr:fix-stepped-interpolation-path
Open

hakarrr wants to merge 4 commits into
chartjs:masterfrom
hakarrr:fix-stepped-interpolation-path

Conversation

@hakarrr

@hakarrr hakarrr commented Oct 26, 2026

Copy link
Copy Markdown

Description

_steppedInterpolation currently uses the opposite before/after convention from _steppedLineTo. At an interior x value, LineElement.interpolate() can return a point on the other plateau rather than on the visible line.

For a lower line from {x: 0, y: 20} to {x: 10, y: 80} with stepped: 'before', the drawn plateau is at 20 until the last point. Interpolating at x=3 currently returns 80. A fill: 'stack' dataset with points at x=2 and x=4 therefore fills down to 80 rather than the visible plateau at 20. The opposite error occurs with 'after'; true has the same issue as 'before'.

Swap the helper's before/after choices to match the existing drawing path. Keep both endpoints and 'middle' unchanged. No drawing or stack-target construction changes are included.

This addresses the plateau sampling part of #10989, not the broader problem of preserving every interior step corner in a constructed stack target. It is independent of #12363's axis/fallback handling and #12326's multiple-segment result handling.

Tests

  • Eight line-element cases compare interpolation with the real drawn Path2D using isPointInStroke, including endpoints, both point directions, before/after/middle and the true alias. Six fail on unchanged master.
  • Sixteen filler pixel cases cover the four step modes, independent x/y scale reversal and repeated updates. Twelve fail on unchanged master; middle is a control.
  • Update existing helper expectations to agree with the unchanged drawing path.

Fresh frozen-lockfile dependency install, full native ChromeHeadless suite: 1727 passed. Rollup build, declaration emit, TypeScript noEmit and ESLint on all four changed files passed. Firefox and downstream plugin tests were not run. Local Chrome launcher settings are not part of the diff.

hakarrr and others added 4 commits October 26, 2026 21:28
Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
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