Skip to content

fix(gauge): keep the progress list when neither pointer nor progress is shown - #21864

Open
Xnadir wants to merge 1 commit into
apache:masterfrom
Xnadir:fix/gauge-progress-after-hidden
Open

Xnadir wants to merge 1 commit into
apache:masterfrom
Xnadir:fix/gauge-progress-after-hidden

Conversation

@Xnadir

@Xnadir Xnadir commented Nov 23, 2026

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Keeps the gauge's progress element list on every render, so turning the progress on after a render with neither pointer nor progress no longer throws.

Fixed issues

Details

Before: What was the problem?

GaugeView._renderMain stored this._progressEls only inside if (showProgress || showPointer). With pointer.show: false and progress.show: false, it was never set, or it kept the elements of an older render. The next setOption with progress.show: true read oldProgressData[oldIdx] in the update branch, which threw TypeError: Cannot read properties of undefined (reading '0'), and no ring was drawn.

After: How does it behave after the fixing?

this._progressEls = progressList now runs on every render, outside that if. After a render that draws no progress the list is empty, so the update branch starts the ring from startAngle, as it does for a new item.

New unit test test/ut/spec/series/gauge.test.ts:

  • "number only" (no pointer, no progress), then "ring" (progress on): no throw, and one more progress sector is drawn. On master it fails with the TypeError.
  • progress on, off, on again: no throw.

Ran locally: npx jest --config test/ut/jest.config.cjs test/ut/spec/series (7 passed), eslint on the changed files, tsc -p tsconfig.json --noEmit.

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 (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

This change was written with the help of Claude Code (AI). I reviewed it and ran the tests above.

🤖 Generated with Claude Code

…is shown. close apache#21863

GaugeView stored _progressEls only when the pointer or the progress was
shown. After a render with both hidden it stayed undefined (or kept the
elements of an older render), so turning the progress on afterwards
threw "Cannot read properties of undefined (reading '0')" and no ring
was drawn. It is now stored on every render.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@echarts-bot

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