I\'m looking to append html onto a rectangle in D3 to give me a multiple line tooltip. The bottom part is how I\'m adding a rectangle which may be part of the problem. The
Have you tried the SVG text element?
.append("text").text(function(d, i) { return d[whichevernode];})
rect element doesn't permit text element inside of it. It only allows descriptive elements (
) and animation elements (
)
Append the text element as a sibling and work on positioning.
UPDATE
Using g grouping, how about something like this? fiddle
You can certainly move the logic to a CSS class you can append to, remove from the group (this.parentNode)