How can I wrap long text labels with D3.js?
问题 I have created a node-tree using D3 and would like to understand how to wrap texts that are too long. nodeUpdate.select("text") .text(function(d) { if(d.name == "root"){ return ""; } else { return d.name; } }) .style("font-family", "Verdana") .style("fill-opacity", 1); If d.name is too long I'd like it to fill several lines instead of one. I have found this http://bl.ocks.org/mbostock/7555321 but I do not seem to understand how this works, and I certainly don't understand how the "wrap"