Reputation: 11228
I have a donut chart with a legend.
Problem is that the text of the legend is too long and overflows the size of the container.
How do I carry out a word wrap so that the text continues on the next line?
I tried setting the word-wrap: break-word
property but it did not work.
Upvotes: 3
Views: 1431
Reputation: 3737
As @cuckovic stated, you can use the <foreignObject>
to word wrap. An example of this would be:
<svg width="400px" height="300px">
.
.
<foreignObject width="100" height="50">
<p>Here is a paragraph that requires word wrap.</p>
</foreignObject>
.
.
</svg>
The example given was taken from the Mozilla Developer's site at https://developer.mozilla.org/en-US/docs/Web/SVG/Element/foreignObject
Upvotes: 1