From 26338d20c4f79680cbb3ca005cdeedc92f3cedf9 Mon Sep 17 00:00:00 2001 From: sz-p Date: Wed, 9 Oct 2024 18:50:45 +0800 Subject: [PATCH 1/2] feat(sunburst): sunburst emphasis focus enable relative #20397 --- src/chart/sunburst/SunburstPiece.ts | 5 +++-- src/chart/sunburst/SunburstSeries.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/chart/sunburst/SunburstPiece.ts b/src/chart/sunburst/SunburstPiece.ts index 92114e11ee..0925f16f94 100644 --- a/src/chart/sunburst/SunburstPiece.ts +++ b/src/chart/sunburst/SunburstPiece.ts @@ -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; diff --git a/src/chart/sunburst/SunburstSeries.ts b/src/chart/sunburst/SunburstSeries.ts index 185fc14129..f4b8b94324 100644 --- a/src/chart/sunburst/SunburstSeries.ts +++ b/src/chart/sunburst/SunburstSeries.ts @@ -67,7 +67,7 @@ interface SunburstDataParams extends CallbackDataParams { interface SunburstStatesMixin { emphasis?: { - focus?: DefaultEmphasisFocus | 'descendant' | 'ancestor' + focus?: DefaultEmphasisFocus | 'descendant' | 'ancestor' | 'relative' } } From daf010493c255a206d5b9fba3fe7b293451ed361 Mon Sep 17 00:00:00 2001 From: sz-p Date: Wed, 9 Oct 2024 18:51:06 +0800 Subject: [PATCH 2/2] test(sunburst): sunburst emphasis focus enable relative #20397 --- test/sunburst-emphasis-focus.html | 234 ++++++++++++++++++++++++++++++ 1 file changed, 234 insertions(+) create mode 100644 test/sunburst-emphasis-focus.html diff --git a/test/sunburst-emphasis-focus.html b/test/sunburst-emphasis-focus.html new file mode 100644 index 0000000000..35b59ea6fe --- /dev/null +++ b/test/sunburst-emphasis-focus.html @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + +