How can I start with all the nodes collapsed in d3js?

后端 未结 3 1122
伪装坚强ぢ
伪装坚强ぢ 2020-12-03 15:54

Starting from this example http://bl.ocks.org/1062288 I would like to have a tree with all the nodes collapsed, so the initial graph should contain only one node (the root).

3条回答
  •  悲&欢浪女
    2020-12-03 16:09

    var allnode =  flatten(root);
    for (var i=0;i

    for those still looking for it, here is 2 lines of code. compact and easy to understand.

提交回复
热议问题