Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

d3.js

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

d3.layout.tree()

produces an error:

Cannot read property 'tree' of undefined

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

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

Is the layout really gone or has it been renamed?

like image 689
benji Avatar asked Jul 12 '16 20:07

benji


1 Answers

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
like image 114
ksav Avatar answered Nov 06 '22 09:11

ksav