I'm using D3 to draw a force-directed graph, which is very similar to this example: http://bl.ocks.org/mbostock/1153292
I'm trying to place the arrowheads in the middle of the links instead of the end.
Playing with the attr("refX", 0)
of the marker doesn't help much, because it's absolute and not relative to the link length - my links have varying lengths.
I've been googling around, and my best idea was to replace link.attr("marker-end", ...)
with link.attr("marker-segment", ...)
according to this example (look for the crosses in the middle of the graphs). But this doesn't seem to work.. I'm guessing because it's part of SVG2 draft only but my browser supports a lower version? (I'm using the most recent ver of Chrome btw).
How can I place the arrowheads in the middle of the links?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…