d3js tree.nodes() is not a function

后端 未结 1 1396
小蘑菇
小蘑菇 2021-02-20 13:00

While the below piece of code works find in d3v3, it fails in v4.

 var nodes = tree.nodes(root).reverse(),
      links = tree.links(nodes);
相关标签:
1条回答
  • 2021-02-20 13:26
    import { hierarchy, tree } from 'd3-hierarchy'
    
    // create a hierarchy from the root
    const treeRoot = hierarchy(root)
    tree(treeRoot)
    // nodes
    const nodes = treeRoot.descendants()
    // links
    const links = treeRoot.links()
    
    0 讨论(0)
提交回复
热议问题