Fix SVG text with rectangle width in D3 treemap file

I am wondering if there is an easier way to limit the width of a text label than using a click path.

Here is an example of what I'm looking for regarding labeling: treemap :

enter image description here

Note that labels are truncated by the boundaries of the contained fragments.

This specific example is implemented using <div> tags, which by default have this behavior. But I use SVG <rect> , and I hope there is a more direct way to do this than a separate clip defining a different rectangular shape.

+8
javascript treemap svg label
source share
1 answer

You can wrap each <rect> element in a <svg> element of the same width / height. By default, overflow is hidden in internal <svg> elements.

+3
source share

All Articles