I want to truncate text that is over a predefined limit in d3.
I\'m not sure how to do it.
Here\'s what I have now:
node.append(\"text\
To truncate text use substring
substring
Try this code:
.text(function (d) { if(d.name.length > 5) return d.name.substring(0,5)+'...'; else return d.name; });