Skip to content

fix(grid): account for inverse axis in outerBounds label proportion - #21850

Open
schizophrenicmaniac wants to merge 1 commit into
apache:masterfrom
schizophrenicmaniac:fix/21839-bug-inverse-axis-collapses-the-grid
Open

schizophrenicmaniac wants to merge 1 commit into
apache:masterfrom
schizophrenicmaniac:fix/21839-bug-inverse-axis-collapses-the-grid

Conversation

@schizophrenicmaniac

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Takes axis.inverse into account when layOutGridByOuterBounds computes the label proportion, so an inverted axis no longer collapses the grid.

Fixed issues

Details

Before: What was the problem?

With outerBoundsContain set, the label proportion comes from axis.scale.normalize(), which ignores inverse. On an inverted axis a tick that is right at one edge was treated as being at the opposite edge, so applyProportion divided its few pixels of overflow by ~0.001 and the grid shrank to its minimum. With the option from the issue in a 600×400 container the grid was about 64px tall instead of 237px.

After: How does it behave after the fixing?

The proportion is flipped for inverted axes before the existing y-axis flip, so the grid gets the same size with or without inverse: true. Added a unit test in test/ut/spec/component/grid/outerBounds.test.ts covering both an inverted y axis and an inverted x axis.

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

@echarts-bot

echarts-bot Bot commented Nov 19, 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.

This branch has not been deployed

No deployments
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