How do I create a tree layout using JSON data in d3.v4 - without stratify()

后端 未结 2 1236
野的像风
野的像风 2021-02-07 14:13

I\'m trying to update some d3 code from v3 to version 4. I have a tree diagram using JSON data. The d3.v4 examples show how to convert tabular data (e.g. flare.csv) to hierarchi

2条回答
  •  粉色の甜心
    2021-02-07 14:55

    You need to run d3.hierarchy on your data to get it ready for tree(). Stratify presumably runs hierarchy or is similar in some way. So change the appropriate line to: var root = d3.hierarchy(treeData[0]);

提交回复
热议问题