What does the syntax d._children = d.children; stand for in d3.js?

后端 未结 2 1368
醉梦人生
醉梦人生 2020-12-30 03:19

In various examples on tree visualizations such as this collapsible tree example the syntax d._children = d.children; is used. For example in this code block fr

2条回答
  •  清歌不尽
    2020-12-30 04:14

    I was just testing this via this example below and found that if I replaced the word children with anything else the tree failed to load correctly. I believe children is a required keyword. https://bl.ocks.org/mbostock/4339083

    I just verified this. In order to use another keyword to define children you must use the tree.children() function like this:

    tree.children(function(d){ return d.dependencies; });

提交回复
热议问题