Skip to content

fix(types): allow scriptable and indexed grid tick widths - #12321

Merged
LeeLenaleee merged 2 commits into
chartjs:masterfrom
jakezwang:fix/scriptable-grid-tick-width
Oct 3, 2026
Merged

LeeLenaleee merged 2 commits into
chartjs:masterfrom
jakezwang:fix/scriptable-grid-tick-width

Conversation

@jakezwang

@jakezwang jakezwang commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #12320.

grid.tickWidth already supports scriptable and indexable values at runtime and in the axis styling documentation, but GridLineOptions only accepts a number. Use ScriptableAndArray<number, ScriptableScaleContext>, matching the neighboring lineWidth declaration.

The type regression covers a callback in Partial<GridLineOptions>, an inferred callback in a chart configuration, an array of widths, and a scalar width. The first three cases fail type checking before this change.

Synchronized with upstream master at 714b48c, including the accepted Firefox fixture repair from #12328. The diff against master remains the original two type-related files.

Validation at head 934d2b71d7b27a4d1a35f2af23decc904e7a8f19: pinned pnpm@8.13.0 lint-types (build, declaration generation, and full type suite passed), changed-file ESLint, and git diff --check. The actual-head Ubuntu validation checks out this exact commit and runs the complete Karma CI suite with the repository's coverage flags: 1703/1703 passed in each of Chrome 154, Firefox 155, and Firefox 156. Every test command must return zero for that diagnostic run to pass. Upstream CI and Compressed Size also pass on this updated revision.

The local macOS Chrome run stopped at the existing scale.radialLinear/ticks-below-zero.js image difference (281 pixels / 0.11% against 0.1% tolerance). That same fixture reproduces the identical failure on pristine current master; the Ubuntu suites all pass.

AI assistance: implementation, testing, and this description were prepared with OpenAI Codex.

Signed-off-by: Jake Wang <jakezwang@users.noreply.github.com>
@etimberg

Copy link
Copy Markdown
Member

The test failure might be real

@LeeLenaleee

Copy link
Copy Markdown
Collaborator

Seems this test is failing on all pr's lately

@LeeLenaleee

Copy link
Copy Markdown
Collaborator

This test also seems to fail on my linux machine, altough a lot more tests are failing, almost seems like it makes the blue a slightly different shade because its failing on almost all tests where there are blue areas and is flagging those.

But this test seems to be failing for another reason, havent found the reason out yet.
Will look more into it when I have time

Screenshot from 2026-10-01 01-15-04

@jakezwang

Copy link
Copy Markdown
Contributor Author

I reproduced the same 293-pixel (0.11%) fixture failure on pristine master and this PR in Ubuntu Firefox 155 and 156; within each browser, the captured canvas pixels and point-label geometry are identical between master and this types-only change.

I opened #12328 with a fixture-only repair: disable image smoothing for the overlapping glyph sprites through the existing run callback and regenerate that fixture’s PNG. The comparison threshold/tolerance, all 50 visible labels, 35 overlapping label pairs, and the per-browser chart geometry are preserved. A one-pixel label-padding change still fails the image comparison.

Linux validation passes the complete 1703-test Karma CI suite separately on Chrome 154, Firefox 155, and Firefox 156, plus the isolated fixture checks. This PR’s approved type patch is unchanged. After #12328 is merged, I can sync this branch to pick up the shared CI fix.

AI assistance: investigation, testing, and this update were prepared with OpenAI Codex.

@jakezwang

Copy link
Copy Markdown
Contributor Author

Merged current upstream master, including the accepted #12328 fixture repair, into this branch at 934d2b71d7b27a4d1a35f2af23decc904e7a8f19. The PR diff remains the original type declaration and its regression test.

The full type/build checks and changed-file ESLint pass. Validation of the exact updated head on Ubuntu passes all 1703 Karma tests in each of Chrome 154, Firefox 155, and Firefox 156, using the normal CI coverage flags. The existing macOS radial-tick image mismatch reproduces unchanged on pristine master and is recorded in the updated description.

AI assistance: this validation and update were prepared with OpenAI Codex.

@LeeLenaleee
LeeLenaleee merged commit 7169e65 into chartjs:master Oct 3, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: types Typescript type changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Minor type definition issue with tickWidth in index.d.ts - should be Scriptable<number, ScriptableScaleContext>

3 participants