You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If node.id = 0, but the node's dataIndex is not 0, According to the current logic, id will be set to dataIndex. Then, if there is already a node with id equal to the dataIndex has been added to the Graph, Node with id equal to 0 will not be added to the Graph. The actual count of nodes will be reduced in the Graph.
PS: I don't think using dataIndex as id is a good idea, there are always chance of collisions, e.g. if I change the second id from 0 to false, error also happens. Please consider unique id as alternative.
The text was updated successfully, but these errors were encountered:
Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.
In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.
Technically speaking, id of data should be string values rather than number values. Try changing id and those in target and source to be string will remove the error in your case.
But I think it's reasonable to improve the source code to prevent problems like this.
Version
4.2.1
Reproduction link
https://jsfiddle.net/Lr6vw89u/
Steps to reproduce
"id" : 1,
"name" : "root node",
}, {
"id" : 0,
"name" : "node a",
}]
What is expected?
Graph layouts as normal
What is actually happening?
Echarts throw errors: Cannot set property dataIndex of undefined
This is the bug of file: https://github.com/apache/incubator-echarts/blob/4.2.1/src/data/Graph.js#L104
If node.id = 0, but the node's dataIndex is not 0, According to the current logic, id will be set to dataIndex. Then, if there is already a node with id equal to the dataIndex has been added to the Graph, Node with id equal to 0 will not be added to the Graph. The actual count of nodes will be reduced in the Graph.
PS: I don't think using dataIndex as id is a good idea, there are always chance of collisions, e.g. if I change the second id from 0 to false, error also happens. Please consider unique id as alternative.
The text was updated successfully, but these errors were encountered: