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
/
hierarchy
/
links.js
10 lines
(9 loc)
•
246 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
export
default
function
(
) {
var
root =
this
, links = []; root.
each
(
function
(
node
) {
if
(node !== root) {
// Don’t include the root’s parent, if any.
links.
push
({
source
: node.
parent
,
target
: node}); } });
return
links; }