Ooh, that's gorgeous. +1 indeed!
@guerino1: it looks like you had the stuff already in place to do the positions with transition. However, you will need to run getTotalLength and getPointAtLength at each "tick" of the transition, for each label, which will have to have a pointer to its path. For this, you'll need to create an attrTween. In the example adam posted, almost exactly this is being done, but with the global t rather than the i that you need.
function centerLabel(d, i, a) {
var path = linkPaths[0][i];
return function(t) {
var p = path.getPointAtLength(.5 * path.getTotalLength());
return "translate(" + p.x + "," + p.y + ")";
};
}
// Transition nodes to their new position.
var linkTextUpdate = linkTextItems.transition()
.duration(duration)
.attrTween("transform", centerLabel);
Also: rather than foreignObject for said labels, you may want to use
https://github.com/vijithassar/d3textwrap For grins, here is my code with getPointAtLength approach: the result is much more satisfying that than getBBox.