How to set all descendant nodes and links to same colour as level 2 ancestor?
问题 I have a d3.js tree with descendant nodes receiving their level 2 ancestor's node colour. This is working from level 2 to level 3, but stops working at level 4 and on. Relevant code: var colourScale = d3.scale.ordinal() .domain(["MD","Professional", "Leader", "Advocate", "Clinician", "Educator", "Scholar"]) .range(["#6695c8", "#cd3838","#d48440", "#a8ba5f", "#63b7c0", "#c97eb2", "#ccc136"]); and nodeUpdate.select("circle") .attr("r", 10) .attr("fill-opacity","0.7") .attr("stroke-opacity","1")