Skip to content
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

Merged
merged 6 commits into from
Feb 18, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/chart/sunburst/SunburstPiece.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,15 @@ class SunburstPiece extends graphic.Sector {
state.style.align = textAlign;
state.style.verticalAlign = getLabelAttr(labelStateModel, 'verticalAlign') || 'middle';

state.x = r * dx + layout.cx;
state.y = r * dy + layout.cy;
// set the position of label in center when angle is 2π
if (textAlign === 'center' && angle === 2 * Math.PI) {
state.x = layout.cx;
pissang marked this conversation as resolved.
Show resolved Hide resolved
state.y = layout.cy;
}
else {
state.x = r * dx + layout.cx;
state.y = r * dy + layout.cy;
}

const rotateType = getLabelAttr(labelStateModel, 'rotate');
let rotate = 0;
Expand Down