Skip to content

fix(sunburst): fix root node label may not be centered#21306

Merged
Ovilia merged 3 commits intoapache:masterfrom
akashsonune:feat/align-root-node-label-to-center
Oct 14, 2025
Merged

fix(sunburst): fix root node label may not be centered#21306
Ovilia merged 3 commits intoapache:masterfrom
akashsonune:feat/align-root-node-label-to-center

Conversation

@akashsonune
Copy link
Contributor

@akashsonune akashsonune commented Oct 8, 2025

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

The PR aligns the root node label in sunburst chart at the center.

Fixed issues

This is enhancement request

Details

Before: What was the problem?

The root node label would appear at the bottom half of the inner circle in non expanded mode. there is no way that we could align it to center.

image

After: How does it behave after the fixing?

image

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

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

N.A.

Others

Merging options

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

Other information

@echarts-bot
Copy link

echarts-bot bot commented Oct 8, 2025

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.

⚠️ MISSING DOCUMENT INFO: Please make sure one of the document options are checked in this PR's description. Search "Document Info" in the description of this PR. This should be done either by the author or the reviewers of the PR.

@akashsonune
Copy link
Contributor Author

@Ovilia Can you review the PR

@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2025

The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-21306@9c07df0

@akashsonune akashsonune force-pushed the feat/align-root-node-label-to-center branch from c611cba to 2362925 Compare October 9, 2025 16:55
@akashsonune akashsonune requested a review from Ovilia October 9, 2025 16:57
Copy link
Contributor

@Ovilia Ovilia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the test case you provided, if you print out console.log(angle, layout.r0, layout.r0 === 0, angle === 2 * Math.PI);, you should see SunburstPiece.ts:236 6.283185307179587 0 true false, which means the problem is caused by the precision of Math.PI * 2. So this can be simply fixed as

if (layout.r0 === 0 && isRadianAroundZero(angle - 2 * Math.PI))

And please don't use forced pushes because we need to reserve the commit history. Thanks!

@akashsonune
Copy link
Contributor Author

Based on the test case you provided, if you print out console.log(angle, layout.r0, layout.r0 === 0, angle === 2 * Math.PI);, you should see SunburstPiece.ts:236 6.283185307179587 0 true false, which means the problem is caused by the precision of Math.PI * 2. So this can be simply fixed as

if (layout.r0 === 0 && isRadianAroundZero(angle - 2 * Math.PI))

And please don't use forced pushes because we need to reserve the commit history. Thanks!

@Ovilia Thank you for the feedback. I guess it works perfectly. can you take a look now

@akashsonune akashsonune requested a review from Ovilia October 10, 2025 08:28
@Ovilia Ovilia merged commit b217c9b into apache:master Oct 14, 2025
2 checks passed
@echarts-bot
Copy link

echarts-bot bot commented Oct 14, 2025

Congratulations! Your PR has been merged. Thanks for your contribution! 👍

@Ovilia Ovilia added this to the 6.0.1 milestone Oct 14, 2025
@plainheart plainheart changed the title feat(sunburst): align root node label to center fix(sunburst): fix root node label may not be centered Oct 15, 2025
@akashsonune
Copy link
Contributor Author

Hey @Ovilia , may I ask , when the 6.0.1 planned for a release as we want to integrate this change

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.

2 participants