UNPKG
d3-hierarchy
Version:
latest (3.1.2)
next (2.0.0-rc.4)
3.1.2
3.1.1
3.1.0
3.0.1
3.0.0
2.0.0
2.0.0-rc.4
2.0.0-rc.3
2.0.0-rc.2
2.0.0-rc.1
1.1.9
1.1.8
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
0.3.0
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
0.1.0
0.0.2
0.0.1
Layout algorithms for visualizing hierarchical data.
d3js.org/d3-hierarchy/
d3/d3-hierarchy
d3-hierarchy
/
src
/
treemap
/
slice.js
13 lines
(11 loc)
•
309 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
export
default
function
(
parent, x0, y0, x1, y1
) {
var
nodes = parent.
children
, node, i = -
1
, n = nodes.
length
, k = parent.
value
&& (y1 - y0) / parent.
value
;
while
(++i < n) { node = nodes[i], node.
x0
= x0, node.
x1
= x1; node.
y0
= y0, node.
y1
= y0 += node.
value
* k; } }