Skip to content

fix: apply number format options to zero ticks - #12302

Open
pentaoa wants to merge 1 commit into
chartjs:masterfrom
pentaoa:fix/zero-tick-number-format
Open

pentaoa wants to merge 1 commit into
chartjs:masterfrom
pentaoa:fix/zero-tick-number-format

Conversation

@pentaoa

@pentaoa pentaoa commented Sep 12, 2026

Copy link
Copy Markdown

Fixes #11905. Revisits the zero-tick formatting problem from the author-closed #12260.

Numeric ticks return the literal 0 before applying ticks.format, so currency and percent axes lose their unit at zero. Format zero with the configured locale/options, using zero fractional digits by default and allowing explicit precision to override that default. Keep zero outside automatic scientific-notation selection.

Added chart-level regressions for percent, currency, and explicit two-decimal currency formatting, plus coverage for the existing plain-zero behavior with empty, single-tick, fractional, and large-range tick lists.

Validation on macOS arm64, Chrome Headless 151:

  • The new formatting regression fails on the original code (0 instead of 0%, $0, and $0.00); all 6 core.ticks tests pass with the fix.
  • pnpm run lint passes, including the build and type checks (existing warnings in unchanged files).
  • Full Karma suite: 1,697 passed, 7 failed. Unmodified master: 1,695 passed, the same 7 image-diff failures. The failures are in filler, radialLinear, time, and timeseries image fixtures; no new failures.
  • Rendered currency and percent charts and inspected the resulting labels visually.

AI assistance: OpenAI Codex assisted with implementation, tests, and verification.

@LeeLenaleee LeeLenaleee added this to the Version 4.6.0 milestone Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tick NumberFormat not working for 0

2 participants