如何在新版本的D3中获取节点?
我看到的D3示例使用tree..nodes(root).reverse()
检索节点数组的D3旧版本。 它不适用于最新版本的D3。如何在新版本中获得节点阵列?
The D3 examples I've seen use an old version of D3 with tree.nodes(root).reverse()
to retrieve nodes array.
It does not work with the latest version of D3. How do I get nodes array in the new version?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建一个树布局对象:
从数据中构建根对象:
从树中提取节点:
应该适用于 d3 v7 (请参见工作示例在这里)
Create a tree layout object:
Build a root object from your data:
Extract nodes from the tree:
Should work for D3 V7 (see a working example here)