Hopefully a very simple question.
I'm trying to append a block of html text to nodes (in a force-directed graph). It looks like appending a foreignObject is the best method, as the text has multiple lines, sizes and includes some links/pictures.
But at the moment when I do the obvious...
var text=node.append('foreignObject')
.attr("width", 480)
.attr("height",200)
.append("xhtml:body")
.html("why am I over here? </br> I really want to be over there");
... the text is way off center. Seemingly the top left corner of the foreignObject is at the center of the node. Is there an easy way to center the foreignObject (and then center the text in it) over the node?
Then again, I'm pretty new to this so may be missing something stupid.