Skip to content

fix(dataStack): exclude null values from 'all' stackStrategy to avoid…#21697

Open
aloktomarr wants to merge 1 commit into
apache:masterfrom
aloktomarr:fix/dataStack-stackStrategy-all-null-21685
Open

fix(dataStack): exclude null values from 'all' stackStrategy to avoid…#21697
aloktomarr wants to merge 1 commit into
apache:masterfrom
aloktomarr:fix/dataStack-stackStrategy-all-null-21685

Conversation

@aloktomarr

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Stops a null/'-' value in a lower series from corrupting the whole stack (bars disappearing) when stackStrategy: 'all' is used.

Fixed issues

Details

Before: What was the problem?

In calculateStack (src/processor/dataStack.ts), the stackStrategy === 'all' branch matched unconditionally. When a lower series' value was null/'-' (stored internally as NaN), sum = addSafe(sum, NaN) produced NaN and the loop breaked, so the upper series' stacked bar vanished. The positive/negative/samesign strategies aren't affected because their val > 0 / val < 0 checks already reject NaN.

After: How does it behave after the fixing?

The all branch is guarded with !isNaN(val), so null values are excluded from the stack (consistent with the other strategies) and the remaining values stack correctly. Added a regression unit test (test/ut/spec/data/dataStack.test.ts) covering a stack that contains a null.

Document Info

  • This PR doesn't relate to document changes

Misc

Security Checking

  • This PR uses security-sensitive Web APIs.

ZRender Changes

  • This PR depends on ZRender changes.

Merging options

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

@echarts-bot

echarts-bot Bot commented Jul 17, 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.

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] stackStrategy: 'all' short-circuits and corrupts stack sum with null

1 participant