Skip to content

Commit 845b6a3

Browse files
authored
Merge pull request #20399 from sz-p/feat-20397
feat(sunburst): add new emphasis focus strategy `'relative'` for highlighting ancestor and descendant nodes
2 parents b33058e + daf0104 commit 845b6a3

File tree

3 files changed

+238
-3
lines changed

3 files changed

+238
-3
lines changed

src/chart/sunburst/SunburstPiece.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,9 @@ class SunburstPiece extends graphic.Sector {
151151

152152
const focus = emphasisModel.get('focus');
153153

154-
const focusOrIndices =
155-
focus === 'ancestor' ? node.getAncestorsIndices()
154+
const focusOrIndices = focus === 'relative'
155+
? zrUtil.concatArray(node.getAncestorsIndices(), node.getDescendantIndices())
156+
: focus === 'ancestor' ? node.getAncestorsIndices()
156157
: focus === 'descendant' ? node.getDescendantIndices()
157158
: focus;
158159

src/chart/sunburst/SunburstSeries.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ interface SunburstDataParams extends CallbackDataParams {
6767

6868
interface SunburstStatesMixin {
6969
emphasis?: {
70-
focus?: DefaultEmphasisFocus | 'descendant' | 'ancestor'
70+
focus?: DefaultEmphasisFocus | 'descendant' | 'ancestor' | 'relative'
7171
}
7272
}
7373

test/sunburst-emphasis-focus.html

Lines changed: 234 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)