You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// if we consider the container for our radial node graph as a box encapsulating, half of this container width is essentially the radius of our radial node graph
58
-
letradius=width/2;
65
+
// if we consider the container for our radial node graph as a box encapsulating
66
+
// half of this container width is essentially the radius of our radial node graph
67
+
constradius=width/2;
59
68
60
-
// d3.hierarchy constructs a root node from the specified hierarchical data (our object titled dataset), which must be an object representing the root node
61
-
lethierarchy=d3.hierarchy(root);
69
+
// d3.hierarchy constructs a root node from the specified hierarchical data
70
+
// (our object titled dataset), which must be an object representing the root node
// root.links() gets an array of all the links, where each element is an object containing a source property, which represents the link's source node, and a target property, which represents the link's target node.
81
+
// root.links() gets an array of all the links,
82
+
// where each element is an object containing a
83
+
// source property, which represents the link's source node,
84
+
// and a target property, which represents the link's target node.
72
85
.data(d3root.links())
73
86
.enter()
74
87
.append('path')
75
88
.attr('class','link')
76
-
.attr("d",d3.linkRadial()
89
+
.attr('d',d3.linkRadial()
77
90
.angle(d=>d.x)
78
91
.radius(d=>d.y));
79
92
80
-
letnode=g.selectAll(".node")
93
+
constnode=g.selectAll('.node')
81
94
// root.descendants gets an array of of all nodes
82
95
.data(d3root.descendants())
83
96
.enter()
84
-
.append("g")
97
+
.append('g')
85
98
// assigning class to the node based on whether node has children or not
0 commit comments