d3.js v4 d3.layout.tree has been removed?

后端 未结 1 605
再見小時候
再見小時候 2021-02-07 09:12

After upgrading to d3.js v4.1.1, this line:

d3.layout.tree()

produces an error:

Cannot read property \'tree\' of undefined


        
相关标签:
1条回答
  • 2021-02-07 09:46

    As of D3 v4.0 (June 2016), the tree layout has been renamed. See:

    https://github.com/d3/d3/blob/master/CHANGES.md#hierarchies-d3-hierarchy

    Pursuant to the great namespace flattening:

    • d3.layout.cluster ↦ d3.cluster
    • d3.layout.hierarchy ↦ d3.hierarchy
    • d3.layout.pack ↦ d3.pack
    • d3.layout.partition ↦ d3.partition
    • d3.layout.tree ↦ d3.tree
    • d3.layout.treemap ↦ d3.treemap
    0 讨论(0)
提交回复
热议问题