Skip to content

Conversation

@seekskyworld
Copy link

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

This PR fixes a bug where stacked area charts with stackStrategy: 'samesign' incorrectly draw an area for data points with a value of 0 by strictly excluding 0 from the stacking logic.

Fixed issues

Details

Before: What was the problem?

When stackStrategy is set to 'samesign', the previous implementation treated 0 as a positive value (using a >= 0 check). This caused zero-value points to be stacked on top of the previous series instead of being treated independently. As a result, the chart would render a visual area for the zero value, which is incorrect behavior for a stacked area chart.

After: How does it behave after the fixing?

The stacking logic in src/processor/dataStack.ts has been updated to strictly check for positive (> 0) or negative (< 0) values when using samesign. Zero values are no longer considered part of the stack group. This ensures that no area is drawn for 0 values, providing the correct visual representation.

Validation:

  • A new unit test has been added to test/ut/spec/processor/dataStack.test.ts to verify that 0 values result in NaN for stackedOverDimension.
  • A manual test case test/issue-21467.html has been added for visual verification.

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
Copy link

echarts-bot bot commented Jan 13, 2026

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.

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 Area Chart draw the area even though the value is 0.

1 participant