Skip to content

Commit 4991276

Browse files
committed
added text colors for leaf nodes
1 parent f45f110 commit 4991276

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/app/components/Chart.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ class Chart extends Component {
9696
.attr("x", function (d) {
9797
// this positions how far the text is from leaf nodes (ones without children)
9898
// 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 ? -20 : 23;
99+
return d.x < Math.PI === !d.children ? -7 : 7;
100100
})
101101
.attr("text-anchor", function (d) { return d.x < Math.PI === !d.children ? "start" : "end"; })
102102
// this arranges the angle of the text
103103
.attr("transform", function (d) { return "rotate(" + (d.x < Math.PI ? d.x - Math.PI / 2 : d.x + Math.PI / 2) * 1 / Math.PI + ")"; })
104104
.text(function (d) {
105-
return "state" + d.data.index;
105+
return d.data.index;
106106
});
107107

108108
function reinfeldTidierAlgo(x, y) {

src/app/styles/components/d3graph.css

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
@import url('https://fonts.googleapis.com/css?family=Raleway&display=swap');
2+
body {
3+
background-color: black;
4+
}
25

3-
/* this represents leaf nodes aka no children */
6+
/* this represents leaf nodes aka nodes with no children */
47
.node circle {
58
fill: #5249f7;
69
}
710
.node text {
8-
font-size: 20px;
11+
font-size: 15px;
912
font-family: 'Raleway', sans-serif;;
1013
}
14+
/* this represents text for leaf nodes aka the ones with no children */
15+
.node--leaf{
16+
fill: #F4C1B6;
17+
}
1118

1219
/* this represents those nodes that have children */
1320
.node--internal circle {
@@ -16,12 +23,12 @@
1623
/* modifies text of parent nodes (has children) */
1724
.node--internal text {
1825
fill: white;
19-
font-size: 30px;
26+
font-size: 25px;
2027

2128
}
2229
.link {
2330
fill: none;
2431
stroke: #3853ea ;
2532
stroke-opacity: 0.4;
26-
stroke-width: 30px;
33+
stroke-width: 3px;
2734
}

0 commit comments

Comments
 (0)