I am trying to move the labels of the right most nodes on my Sankey Diagram to follow the node rather than come before the node. I am using the code shown here.
I was able to get the text to follow the node by keying out the filter function line as shown below
// add in the title for the nodes
node.append("text")
.attr("x", -6)
.attr("y", function(d) { return d.dy / 2; })
.attr("dy", ".35em")
.attr("text-anchor", "end")
.attr("transform", null)
.text(function(d) { return d.name + " ("+Math.round(d.value).toLocaleString('en') + ")"; })
//.filter(function(d) { return d.x < width / 2; })
.attr("x", 6 + sankey.nodeWidth())
.attr("text-anchor", "start");
However, now this text is cut off by the right margin. It remains cut off even when adjusting the width of the screen. I suspect there is a line in a code that has the right most nodes go to the right margin. I am 1) trying to find this line and 2) trying to make this apply to the text rather than the node.