d3.js v4 d3.layout.tree是否已删除? [英] d3.js v4 d3.layout.tree has been removed?

查看:125
本文介绍了d3.js v4 d3.layout.tree是否已删除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到d3.js v4.1.1后,此行:

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

d3.layout.tree()

产生错误:

Cannot read property 'tree' of undefined

似乎树形布局已从v4中删除? https://github.com/d3/d3/blob/master/API.md

It seems like the tree layout has been removed from v4? https://github.com/d3/d3/blob/master/API.md

这些示例仍使用v3 API: http://bl.ocks.org/mbostock/1093025

The examples still use the v3 API: http://bl.ocks.org/mbostock/1093025

布局真的消失了还是被重命名了?

Is the layout really gone or has it been renamed?

推荐答案

从D3 v4.0(2016年6月)开始,树布局已重命名.参见:

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
  • 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

这篇关于d3.js v4 d3.layout.tree是否已删除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆