I have been trying to experiment with D3.js and while this question may sound silly, I am not capable of making the links in a graph point to the node borders instead of the node centers.
I have been using the following jsfiddle to test it, but I am still not able to do it...
http://jsfiddle.net/blonkm/zpcJa/40/light/
I suppose that I have to update something in the tick() function to return different values:
function tick() {
path.attr("d", function(d) {
var dx = d.target.x - d.source.x,
dy = d.target.y - d.source.y,
dr = 0; // straight lines (0=straight, 1=round)
// alternatively use dr = Math.sqrt(dx * dx + dy * dy); for similar arcs
return "M" + d.source.x + "," + d.source.y + "A" + dr + "," + dr + " 0 0,1 " + d.target.x + "," + d.target.y;
});
circle.attr("transform", function(d) {
return "translate(" + d.x + "," + d.y + ")";
});
text.attr("transform", function(d) {
return "translate(" + d.x + "," + d.y + ")";
});
}
I would really appreciate if anyone could point me in the right direction, thanks!