You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "susiwen8 (via GitHub)" <gi...@apache.org> on 2026/05/02 03:46:27 UTC
[PR] fix(sunburst): center drilled root labels [echarts]
susiwen8 opened a new pull request, #21598:
URL: https://github.com/apache/echarts/pull/21598
## Summary
Fixes #21133.
When sunburstRootToNode drills into a node, that node can become a full 360-degree annular sector. Its label represents the centered view root rather than an angular slice, so the label should be placed at the chart center and should not inherit radial/tangential rotation.
This PR updates the sunburst label layout for full-circle centered labels and adds a Jest regression test covering both center position and zero rotation.
## Root Cause
SunburstPiece only centered labels for full circles when r0 === 0. After drilldown, the view root is a full annular sector with r0 > 0, so the label was placed at the annulus midpoint and still received radial rotation.
## Verification
- git diff --check
- eslint src/chart/sunburst/SunburstPiece.ts test/ut/spec/series/sunburst.test.ts
- tsc --noEmit
- jest --config test/ut/jest.config.cjs --coverage=false --runInBand test/ut/spec/series
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [PR] fix(sunburst): center drilled root labels [echarts]
Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] commented on PR #21598:
URL: https://github.com/apache/echarts/pull/21598#issuecomment-4362843477
Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/echarts/wiki/How-to-make-a-pull-request).
The pull request is marked to be `PR: author is committer` because you are a committer of this project.
To reviewers: If this PR is going to be described in the changelog in the future release, please make sure this PR has one of the following labels: `PR: doc ready`, `PR: awaiting doc`, `PR: doc unchanged`
This message is shown because the PR description doesn't contain the document related template.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [PR] fix(sunburst): center drilled root labels [echarts]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #21598:
URL: https://github.com/apache/echarts/pull/21598#issuecomment-4362856472
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-21598@0f082e6
<!-- ECHARTS_PR_PREVIEW -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [PR] fix(sunburst): center drilled root labels [echarts]
Posted by "Ovilia (via GitHub)" <gi...@apache.org>.
Ovilia commented on code in PR #21598:
URL: https://github.com/apache/echarts/pull/21598#discussion_r3206076875
##########
src/chart/sunburst/SunburstPiece.ts:
##########
@@ -233,9 +235,10 @@ class SunburstPiece extends graphic.Sector {
}
else {
if (!textAlign || textAlign === 'center') {
- // Put label in the center if it's a circle
- if (layout.r0 === 0 && isRadianAroundZero(angle - 2 * Math.PI)) {
+ // Put label in the center if it's a full circle.
+ if (isFullCircle) {
Review Comment:
The case `layout.r0 === 0` is removed. Is this intentional?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [PR] fix(sunburst): center drilled root labels [echarts]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #21598:
URL: https://github.com/apache/echarts/pull/21598#discussion_r3176047293
##########
test/ut/spec/series/sunburst.test.ts:
##########
@@ -0,0 +1,102 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+import { EChartsType } from '@/src/echarts';
+import SunburstSeriesModel from '@/src/chart/sunburst/SunburstSeries';
+import { TreeNode } from '@/src/data/Tree';
+import { createChart, getECModel } from '../../core/utHelper';
+
+function findNodeByName(seriesModel: SunburstSeriesModel, name: string): TreeNode {
+ let targetNode: TreeNode;
+
+ seriesModel.getData().tree.root.eachNode(node => {
+ if (node.name === name) {
+ targetNode = node;
+ }
+ });
+
+ return targetNode;
+}
Review Comment:
`findNodeByName` can return `undefined` at runtime if the node name is not found, but its return type is `TreeNode`. This would produce a less clear failure later (e.g., `dispatchAction` receiving an invalid `targetNode`). Consider returning `TreeNode | undefined` and asserting in the test, or throwing an explicit error when no match is found.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org