Some tools to help with dealing with text in D3.
If you use NPM, npm install d3-text
. Otherwise, download the latest release.
Splits a text
element into a number of tspan
elements so as to automatically wordwrap the text, given
# textwrap()
Constructs new textwrap helper.
var textwrap = d3_text.textwrap();
# textwrap.bounds({bounds})
bounds is expected to be an object with the values x
, y
, width
, and height
.
# textwrap.padding({padding})
padding is expected to be an object with x
and y
values.
Inspired or remixed or duplicated by: