-
Notifications
You must be signed in to change notification settings - Fork 19.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(sunburst) set the position of label in center when angle is 2π. c… #16425
Conversation
Thanks for your contribution! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Placing labels with position: 'center'
at the center of the sunburst may not be universal. Consider the case when the second level sectors having the angle of 2π, if its label is put at the center of the sunburst, there may be another sector at the first level also being a circle and having label. I think maybe it's safe to put the label at center only when the sector's inner radius is 0, or provide a new value for labels at the center like 'inner'
.
src/chart/sunburst/SunburstPiece.ts
Outdated
@@ -219,7 +219,13 @@ class SunburstPiece extends graphic.Sector { | |||
} | |||
else { | |||
if (!textAlign || textAlign === 'center') { | |||
r = (layout.r + layout.r0) / 2; | |||
// set the position of label in center when angle is 2π & r0 is 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be more clear to be commented
// Put label in the center if it's a circle.
Current comment is just an plain explaination on the code.
Congratulations! Your PR has been merged. Thanks for your contribution! 👍 |
…lose #16296
Brief Information
This pull request is in the type of:
What does this PR do?
Fix a bug that the Sunburst center text cannot be centered vertically.
Fixed issues
#16296
Details
Before: What was the problem?
when the sector's angle is 2π, and inner radius is 0(which means at the first level). the position of label cannot be the center of the circle, which lead to the text of label cannot be centered vertically in Sunburst.
After: How is it fixed in this PR?
set the position of label in center when angle is 2π and inner radius is 0 so that the text of label can be centered vertically in Sunburst.
Misc
Related test cases or examples to use the new APIs
N.A.
Others
Merging options
Other information