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

后端 未结 2 1366
醉梦人生
醉梦人生 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:15

    _children is just a temp variable that holds the children when they are hidden. When you click you are either taking children to null and storing the children in the temp variable, or, if children is already null, loading them from the temp variable.

    Any temp variable could have been used. There is nothing special about _children. It is used to show an obvious relationship to children.

提交回复
热议问题