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

   ### What problem does this feature solve?
   
   In the graph component, it is necessary to add an "id" attribute to each 
element in the data, and then use this "id" to establish connections in the 
"links" through the "target" and "source" attributes.
   
   When working with the graph, a unique identifier is needed to handle cases 
where nodes have the same name. While the ECharts documentation mentions that 
the "links" support using "name" and the index of data, using "name" may lead 
to situations with identical names, and using the index is not convenient when 
dealing with dynamic data.
   
   I propose using an "id" to specify nodes and establish connections through 
the "links." In fact, ECharts already supports using "id," but this is not 
explicitly documented. It's important to note that the "id" cannot be a number; 
it must be a string. If it's a number, ECharts recognizes it as a data index.
   
   You can then use these "id" values in the "links," where the "target" and 
"source" values should be the same as the "id" set in the data.
   
   I will provide an example below. If this is not a bug, I suggest documenting 
this feature. If it is a bug, I hope this functionality can be made available 
in the next release.
   
   ### What does the proposed API look like?
   
   ### example
   ```JavaScript
    data: [
           { name: '李白', category: '亲人', id: '1' },
           { name: '杜甫', category: '亲人', id: '2' },
           { name: '李白', category: '租户', id: '3' },
           { name: '王之涣', category: '租户', id: '4' },
           { name: '王之涣', category: '亲人', id: '5' },
           { name: '杜甫', category: '亲人', id: '6' }
         ],
   links: [
           { source: '4', target: '5', value: '夫妻' },
           { source: '2', target: '3', value: '租赁' },
           { source: '3', target: '4', value: '亲人' },
           { source: '1', target: '5', value: '亲人' },
           { source: '1', target: '2', value: '亲人' },
           { source: '4', target: '6', value: '亲人' },
         ]
   ```
   
![image](https://github.com/apache/echarts/assets/113961416/e05d2c5c-0b33-445a-9257-e260ae63f09c)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to