Ovilia commented on code in PR #17451: URL: https://github.com/apache/echarts/pull/17451#discussion_r954746068
########## src/chart/graph/GraphSeries.ts: ########## @@ -69,7 +69,7 @@ export interface GraphNodeStateOption<TCbParams = never> { interface ExtraEmphasisState { - focus?: DefaultEmphasisFocus | 'adjacency' + focus?: DefaultEmphasisFocus | 'adjacency' | 'fullPath' Review Comment: Do you have other suggestions for the name of this new value? We should avoid using two words because developers may misspell it to be `'fullpath'`. ########## src/chart/sankey/SankeyView.ts: ########## @@ -231,7 +231,9 @@ class SankeyView extends ChartView { const focus = emphasisModel.get('focus'); toggleHoverEmphasis( curve, - focus === 'adjacency' ? edge.getAdjacentDataIndices() : focus, + focus === 'adjacency' ? edge.getAdjacentDataIndices() + : focus === 'fullPath' ? edge.getFullPathDataIndices() + : focus, Review Comment: Since we are using this logic for multiple times, please consider making a function to reuse. ########## src/data/Graph.ts: ########## @@ -387,6 +387,49 @@ class GraphNode { } return dataIndices; } + + getFullPathDataIndices(): {node: number[], edge: number[]} { + const dataIndices = { + edge: [] as number[], + node: [] as number[] + }; + + for (let i = 0; i < this.edges.length; i++) { + const adjacentEdge = this.edges[i]; + if (adjacentEdge.dataIndex < 0) { + continue; + } + + dataIndices.edge.indexOf(adjacentEdge.dataIndex) === -1 + ? dataIndices.edge.push(adjacentEdge.dataIndex) : null; Review Comment: Use `zrUtil.indexOf` instead of `indexOf` -- 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-unsubscr...@echarts.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org