svg text wrapping issues

The drawTick() function is calling another function called wrap() to plot the text. As might be suggested by that name, wrap() is splitting the input text into words and wrapping it onto a new line if it gets wider than the width you pass in.

The width value is the “30” in the following line:

.call(wrap,30,label)

Try changing it to something bigger so that it doesn’t wrap so soon. 180 seems to be about the right value.

https://jsfiddle.net/sxs5n2cw/4/

Leave a Comment