weihaopeng opened a new issue, #17564:
URL: https://github.com/apache/echarts/issues/17564

   ### What problem does this feature solve?
   
   I want to highlight a node, and its path to the root node. I use 
`dispatchAction` function with `type highlight`, set the nodeIndex in the path 
to `dataIndex` attr. Like this (node11 is the root node):
   
   
![image](https://user-images.githubusercontent.com/33681454/186376922-071a2ba9-4fdc-4d7f-8455-9dbb0cfa7914.png)
   
   The result is :
   * node11 was highlight
   * node11's related node(include node24) and line were highlight
   * node40 was highlight, but the line connecting node24 and node40 weren't 
highlight`.
   
   Then I reverse the dataIndex, set `[40, 24, 11]`. I get the result:
   * node40 was highlight
   * the line connecting node40 and node24 was highlight, node24 was highlight
   * node24's related node was highlight
   * node11 was highlight, node11's related nodes weren't highlight.
   
   I think this is a defect. It seems that it highlight first node and first 
node's related nodes and their lines, and other node in the `dataIndex` list. 
But according to [the 
doc](https://echarts.apache.org/zh/api.html#action.highlight), `dataIndex` 
means "数据项的index", 'index of data'. It should Has nothing to do with line, and 
any related nodes(maybe this is conflict with the `emphasis.focus: 'adjacency'` 
?)
   
   ### Above content should be a bug or a defect, I think. here comes the 
feature I want. Add `linkIndex` or `edgeIndex` attr to the option in 
dispatchAction function. So that developers can clearly define which line 
should be highlight.
   
   [code is 
here](https://codesandbox.io/s/les-miserables-forked-z3y4p0?file=/index.js), it 
use `les-miserables` in document. After mounted, waiting 3s, I use a 
dispatchAciton function to highlight three nodes.
   
   The node11 is the green node `Valjean`, the node24 is the purple node 
`Thenardier`, the node40 is the top node with label hidden.
   
   
![image](https://user-images.githubusercontent.com/33681454/186381535-eb5b91dc-403f-424e-80ec-cf1bcd5d5fcf.png)
   
   ### What does the proposed API look like?
   
   dispatchAction({
       type: 'highlight',
       ...
   
       dataIndex?: number | number[], // only effect these data, no effect to 
related data.
       name?: string | string[],
       lineIndex?: number | number[]
   });


-- 
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.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

Reply via email to