Skip to content

Conversation

akashsonune
Copy link

@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

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
Author

@Ovilia Can you review the PR

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@c611cba

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