Skip to content

Commit

Permalink
Merge pull request #20399 from sz-p/feat-20397
Browse files Browse the repository at this point in the history
feat(sunburst): add new emphasis focus strategy `'relative'` for highlighting ancestor and descendant nodes
  • Loading branch information
plainheart authored Oct 10, 2024
2 parents b33058e + daf0104 commit 845b6a3
Show file tree
Hide file tree
Showing 3 changed files with 238 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/chart/sunburst/SunburstPiece.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ class SunburstPiece extends graphic.Sector {

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

const focusOrIndices =
focus === 'ancestor' ? node.getAncestorsIndices()
const focusOrIndices = focus === 'relative'
? zrUtil.concatArray(node.getAncestorsIndices(), node.getDescendantIndices())
: focus === 'ancestor' ? node.getAncestorsIndices()
: focus === 'descendant' ? node.getDescendantIndices()
: focus;

Expand Down
2 changes: 1 addition & 1 deletion src/chart/sunburst/SunburstSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ interface SunburstDataParams extends CallbackDataParams {

interface SunburstStatesMixin {
emphasis?: {
focus?: DefaultEmphasisFocus | 'descendant' | 'ancestor'
focus?: DefaultEmphasisFocus | 'descendant' | 'ancestor' | 'relative'
}
}

Expand Down
234 changes: 234 additions & 0 deletions test/sunburst-emphasis-focus.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 845b6a3

Please sign in to comment.