Skip to content

fix(scale): handle tiny nice intervals. close #21645#21667

Open
rahul37wallst-sudo wants to merge 1 commit into
apache:masterfrom
rahul37wallst-sudo:investigate-21645-tiny-axis-max
Open

fix(scale): handle tiny nice intervals. close #21645#21667
rahul37wallst-sudo wants to merge 1 commit into
apache:masterfrom
rahul37wallst-sudo:investigate-21645-tiny-axis-max

Conversation

@rahul37wallst-sudo

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Fix tiny value-axis tick calculation so valid sub-1e-20 extents do not collapse to zero during rounding.

Fixed issues

Details

Before: What was the problem?

For very small positive value-axis extents, such as a yAxis.max of 2.324097633474072e-20, the tick interval calculation could request a precision greater than the cross-platform toFixed(20) limit.

The shared round helper clamped that precision to 20, which could over-round tiny values such as 3e-21 to 0. This produced invalid interval/nice extent values and could trigger an assertion error in IntervalScale.setConfig, preventing the chart from rendering.

After: How does it behave after the fixing?

When the requested rounding precision is above the supported toFixed limit, round now returns the numeric value directly instead of clamping to 20 and over-rounding it.

This keeps tiny positive nice intervals finite and non-zero, so value axes with valid small numeric extents can calculate ticks and render successfully.

Added regression coverage in:

  • test/ut/spec/scale/interval.test.ts
  • test/ut/spec/util/number.test.ts

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

Security Checking

  • This PR uses security-sensitive Web APIs.

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

N.A.

Merging options

  • Please squash the commits into a single one when merging.

Other information

Validation run locally:

  • npx jest --config test/ut/jest.config.cjs --coverage=false --runInBand --runTestsByPath test/ut/spec/scale/interval.test.ts test/ut/spec/util/number.test.ts
  • npm run checktype
  • pre-commit npm run lint
  • git diff --check

@echarts-bot

echarts-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only.

@plainheart plainheart requested a review from 100pah July 1, 2026 06:28
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.

1 participant