antvis / G6

♾ A Graph Visualization Framework in JavaScript.
https://g6.antv.antgroup.com/
MIT License
11.1k stars 1.32k forks source link

Dendogram collapse issue with many child nodes #1485

Closed renjiie closed 4 years ago

renjiie commented 4 years ago

Hi I tried the vertical dendogram with antv g6 but for more children nodes the collapse is not working properly. On click of the node it is not getting collapsed. For the demo data it is working My code link is in : https://codesandbox.io/s/dendogram-antv-5v4y7?file=/src/treeGraph.js

Yanyan-Wang commented 4 years ago

The id of each node MUST be UNIQUE.

e.g. Following code assigns unique id for each node rather than name which might not unique.

let count = 0;
G6.Util.traverseTree(data1, subtree => {
  subtree.id = `node-${count}`;
  count++;
  return true;
});
renjiie commented 4 years ago

@Yanyan-Wang thank you saved me big time