Skip to content

Commit 1eb4064

Browse files
committed
fixed d3 tree layout algorithm
1 parent 4991276 commit 1eb4064

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/app/components/Chart.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,16 @@ class Chart extends Component {
8888
});
8989

9090
node.append("circle")
91-
.attr("r", 35.5)
91+
.attr("r", 20)
9292

9393
node
9494
.append("text")
95-
.attr("dy", "0.1em")
95+
// adjusts the y coordinates for the node text
96+
.attr("dy", "0.3em")
9697
.attr("x", function (d) {
9798
// this positions how far the text is from leaf nodes (ones without children)
9899
// negative number before the colon moves the text of rightside nodes, positive number moves the text for the leftside nodes
99-
return d.x < Math.PI === !d.children ? -7 : 7;
100+
return d.x < Math.PI === !d.children ? -6 : 7;
100101
})
101102
.attr("text-anchor", function (d) { return d.x < Math.PI === !d.children ? "start" : "end"; })
102103
// this arranges the angle of the text

0 commit comments

Comments
 (0)