I came up with a somewhat ugly but workable solution for this. You
need to adjust the refX on the marker definition. But can't just
change the marker-- or else all the other arrows will change.
Instead you need to create as many markers as arrow positions.
Something like this:
vis.append("svg:defs").selectAll("marker.arrow")
.data( d3.range(1,Math.ceil(Math.sqrt(maxsize))) )
.enter().append("svg:marker")
.attr("id", function(d) { return "arrow-" + d})
.attr("class", "arrow")
.attr("viewBox", "0 -5 10 10")
.attr("refX", function(d) { return 13+d })
.attr("refY", 0)
.attr("markerWidth", 5)
.attr("markerHeight", 5)
.attr("orient", "auto")
.append("svg:path")
.attr("d", "M0,-5L10,0L0,5");
Then for the links, select the end marker id based on where it needs to be:
.attr("marker-end", function(d) { return "url(#arrow-" +
Math.ceil(Math.sqrt(json.nodes[d.target.index].size)) + ")"; })
Really not an ideal solution. You could also try adjusting the x2, y2
so that the line only goes to the edge of the circle. Might have to do
a little trig.
Let us know what you come up with, it'd be great to have a simple way
to do this that doesn't involve creating a bunch of marker
definitions.