This is an automated email from the ASF dual-hosted git repository. wangzx pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/echarts.git
The following commit(s) were added to refs/heads/master by this push: new a44c7f5f1 feat(tree): `tree` focus supports `relative` new 84b957855 Merge pull request #17009 from susiwen8/tree-relative a44c7f5f1 is described below commit a44c7f5f119bf4e1ecd3512762935ff817f34f2b Author: susiwen8 <susiw...@gmail.com> AuthorDate: Wed May 11 11:48:08 2022 +0800 feat(tree): `tree` focus supports `relative` --- src/chart/tree/TreeSeries.ts | 2 +- src/chart/tree/TreeView.ts | 8 +++++--- test/tree-legend.html | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/chart/tree/TreeSeries.ts b/src/chart/tree/TreeSeries.ts index 03d85113d..659dfc16c 100644 --- a/src/chart/tree/TreeSeries.ts +++ b/src/chart/tree/TreeSeries.ts @@ -55,7 +55,7 @@ export interface TreeSeriesStateOption<TCbParams = never> { interface TreeStatesMixin { emphasis?: { - focus?: DefaultEmphasisFocus | 'ancestor' | 'descendant' + focus?: DefaultEmphasisFocus | 'ancestor' | 'descendant' | 'relative' scale?: boolean } } diff --git a/src/chart/tree/TreeView.ts b/src/chart/tree/TreeView.ts index b868c6b9c..2fab46a34 100644 --- a/src/chart/tree/TreeView.ts +++ b/src/chart/tree/TreeView.ts @@ -485,9 +485,11 @@ function updateNode( // Handle status const focus = itemModel.get(['emphasis', 'focus']); - const focusDataIndices: number[] = focus === 'ancestor' - ? node.getAncestorsIndices() - : focus === 'descendant' ? node.getDescendantIndices() : null; + const focusDataIndices: number[] = focus === 'relative' + ? zrUtil.concatArray(node.getAncestorsIndices(), node.getDescendantIndices()) as number[] + : focus === 'ancestor' + ? node.getAncestorsIndices() + : focus === 'descendant' ? node.getDescendantIndices() : null; if (focusDataIndices) { // Modify the focus to data indices. diff --git a/test/tree-legend.html b/test/tree-legend.html index fbc1357c6..c5f03c686 100644 --- a/test/tree-legend.html +++ b/test/tree-legend.html @@ -235,7 +235,9 @@ under the License. right: '60%', symbolSize: 7, - + emphasis: { + focus: 'relative' + }, label: { position: 'left', verticalAlign: 'middle', --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org