Skip to content

Preserve numeric gaps when styling line segments - #12367

Open
hakarrr wants to merge 2 commits into
chartjs:masterfrom
hakarrr:fix/numeric-gap-segment-styles
Open

hakarrr wants to merge 2 commits into
chartjs:masterfrom
hakarrr:fix/numeric-gap-segment-styles

Conversation

@hakarrr

@hakarrr hakarrr commented Oct 26, 2026

Copy link
Copy Markdown

Problem

With numeric spanGaps, adding a segment-style callback reconnects line sections that exceed the configured gap limit. For example, points at x=0,5,30,35 with spanGaps: 10 produce sections 0-1 and 2-3 without styling, but sections 0-1 and 1-3 with a segment.borderColor callback. The 25-unit gap is drawn despite the existing stop flag.

Change

Only reuse the previous style section's start when spanGaps === true. Numeric gap limits already produce separate solid sections, so start each styled section at its own boundary.

This preserves boolean gap-spanning behavior and does not change public APIs. It is independent of #12365, which addresses curve control points rather than style splitting.

Tests

  • 28 added cases covering x/y index axes, reversed scales, uniform/changing colors, transparent canvas pixels inside forbidden gaps, repeated updates, boolean spans, numeric limits with no break, and skipped-point controls.
  • Pristine master: 14 of the 28 cases fail. With the fix: all 28 pass.
  • Fresh frozen-lockfile dependency install, then native Karma/ChromeHeadless suite: 1731/1731 pass.
  • pnpm build including declaration generation and tsc --noEmit: pass.
  • Changed-file ESLint: no errors, two existing complexity/statement-count warnings in _boundSegment.
  • Actual before/after canvas rendering checked: the forbidden connecting line disappears while both intended sections remain.

Firefox and downstream integration suites were not run.

hakarrr and others added 2 commits October 26, 2026 19:48
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