javascript - d3js Force layout multiple arcs with arrows -


i basing question on following example: http://bl.ocks.org/mbostock/1153292

if create 2 links same source , target, say

{source: "microsoft", target: "htc", type: "licensing"}, {source: "microsoft", target: "htc", type: "suit"}, 

then 2 links sit on top of each other , 1 visible. how can rewrite code in case 2 links form loop happens 2 links inverted sources , targets, example

{source: "microsoft", target: "motorola", type: "suit"}, {source: "motorola", target: "microsoft", type: "suit"}, 

ok, find solution 1 myself. in

function linkarc(d) {   var dx = d.target.x - d.source.x,       dy = d.target.y - d.source.y,       dr = math.sqrt(dx * dx + dy * dy);   return "m" + d.source.x + "," + d.source.y + "a" + dr + "," + dr + " 0 0,1 " + d.target.x + "," + d.target.y; } 

if " 0 0,1 " part changed " 0 0,0 " changes chirality of arc, if statement in needed distinguish cases there 2 links same source , target.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -