http://www.w3.org/TR/SVG/painting.html#Markers
Mike
Mike
I wouldn't recommend changing the behavior of right click; that's
standard browser functionality for the context menu. It is possible to
preventDefault on right-click events and change the behavior, but it's
not supported by the force layout's drag behavior. You might be able
to add a mousedown handler and do it yourself, though.
Mike
It demonstrates how to use markers and curved paths for directed
edges. (If you wanted to be totally accurate, then the edges would
start and end at each circle's circumference rather than the center,
but, close enough!)
Mike
--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Jim
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Jim McCusker
Programmer Analyst
Krauthammer Lab, Pathology Informatics
Yale School of Medicine
james.m...@yale.edu | (203) 785-4436
http://krauthammerlab.med.yale.edu
PhD Student
Tetherless World Constellation
Rensselaer Polytechnic Institute
mcc...@cs.rpi.edu
http://tw.rpi.edu
--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Regards,
Johnson Chetty
Hi Jim, Hi Johnson,Thanks for your pointers!Btw, Johnson, I imagine that your this.arrowhead looks something likesvg.append("svg:defs").append("svg:marker").attr("id", "arrowhead").attr('viewBox', '0 -5 10 10').attr('refX', 7).attr('refY', 0).attr("markerWidth", 3).attr("markerHeight", 3).attr("orient", "auto").append("svg:path").attr('d', 'M0,-5L10,0L0,5');Am I right?
However, yesterday I managed to have a more-or-less working version with curved lines but I've a couple of problems understanding the real mechanics of paths and markers...In particular, I cannot understand, neither by reading the SVG doc neither by trying to modify them, the parameters 'viewBox','refX', and 'refY'. Any intuition?
links.arrowhead.attr("points", function(d) {return [[d.x2,d.y2].join(","),[d.x2-3,d.y2+8].join(","),[d.x2+3,d.y2+8].join(",")].join(" ");}).attr("transform",function(d) {angle = Math.atan2(d.y2-d.y1, d.x2-d.x1)*180/Math.PI + 90;return "rotate("+angle+", "+d.x2+", "+d.y2+")";});
The second part adjusts the line ends to not hit the box bounds (line 771). It assumes rectangles, but circles would be even easier. It needs the functions makeCenteredBox() (the boxes get drawn with the x,y at the center) and computes the edge point along the same angle approach using edgePoint().