d3.js - D3 js line overlaps node -


I'm doing the force layout, by clicking on the event, I add a new node and connect to the line. But how do line overlap nodes? My code has been shown

  click the function (d) {if (d3.event.defaultPrevented) return; // unseen // warning ("click"); Var d = {id: "d"}; Nodes.push (nodeId [index]); If (index == 0) link Push ({source: a, target: nodeId [index]}); Else links.push ({source: nodes [1], target: nodeID [index]}); Index ++; Start(); }  

In SVG, the easiest way to get all the lines is visible below the board. , Group all the lines and all the circles in all of their groups and define the order of Z. to these groups.

I've just added two groups to be created in linksG and nodesG element elements:

  var linkG = Svg.append ("g"), nodeg = svg.append ("live"); Var node = node g. Sealalt (". Node"), link = linkG.selectAll (".link");  

Look for a demo.

EDIT: Forgot to save Bella Link Fixed


Comments