问题
How to avoid links overlap in d3.js using force layout ? I have divided screen into two halves, the upper half nodes are connected to bottom half nodes using links , sometimes there is a criss cross of links , how can i avoid that ?
回答1:
The short answer is that you can't. The longer answer is that the force layout that D3 implements does nothing to prevent overlapping links and there are no parameters you can set to do that. What you can do is try to adjust the parameters that are there and see if they happen to help with this problem.
The force layout implemented in sigma js does try to minimise the number of links that cross, so if you don't absolutely need D3, this would be an alternative you could look into.
来源:https://stackoverflow.com/questions/29006725/avoid-links-criss-cross-overlap-in-d3-js-using-force-layout