Skip to content

fix(bar): keep stacked bars connected during animation - #21811

Open
Justineo wants to merge 3 commits into
apache:masterfrom
Justineo:fix/stacked-bar-animation-main
Open

Justineo wants to merge 3 commits into
apache:masterfrom
Justineo:fix/stacked-bar-animation-main

Conversation

@Justineo

@Justineo Justineo commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
AI disclosure

Codex Astra High implemented and tested this PR and drafted the description. Claude Opus 5.5 High reviewed the changes. I set the requirements, checked the playground, and approved publication.

Codex was asked to:

Claude reported bugs and proposed simplifications. Codex checked the findings with reproductions and tests before applying the changes. It also added tests for shared timing callbacks with reordered categories and for removed series whose indices were reused.

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Keeps Cartesian stacked bars connected during entrance animations and interrupted legend transitions.

Interactive playground compares upstream, #20862, and this fix across 16 cases.

Fixed issues

Fixes #19095. Supersedes #20862 by @Enigmatrix.

Details

Before: What was the problem?

Segments grow at their final positions, leaving gaps during entrance. Hiding a middle series removes it before its neighbors finish moving. Showing it again before the animation ends can cause a jump.

After: How does it behave after the fixing?

Segments with matching entrance timing grow from a shared baseline. Hidden bars shrink as their neighbors move. Rapid toggles reverse the animation from the current shape.

  • Reuse the baseline and stacking rules from layout and stack calculation.
  • Handle reordered categories, descending stacks, removed series, and bars recreated after missing values.
  • Preserve update duration, easing, and delay.
  • Compare entrance timing only when a new animated bar needs it, without calling user callbacks for the comparison.

Hidden stacked views keep their last rendered data so they can be restored. This keeps the data in memory while the series is hidden.

Different animation timings can still produce gaps. barMinHeight layout is unchanged. The playground includes both cases.

Document Info

  • 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

  • test/bar-cartesian-stack-anim.html
  • test/ut/spec/series/barAnimation.test.ts

All 284 unit tests pass, including 90 bar animation tests. Type checks and ESLint pass. Browser checks covered 32 playground combinations across Canvas and SVG.

Merging options

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

Other information

N.A.

@echarts-bot

echarts-bot Bot commented Oct 29, 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.

[Bug] Stacked Bar Animation has gaps between series

1 participant