Mysterious forces in d3 power orientation layout?

I am trying to gradually combine the two groups of nodes to simulate a kind of summary pie chart using a force layout. For this, I use two groups of nodes connected via links to two fixed, animated focus nodes, respectively. When they combine with ruffly the same number of nodes, the effect works well.

see http://bl.ocks.org/vicapow/6191895

however, when there is a big difference in the groups of nodes (for example, 1/100), it seems that some mysterious additional force is applied to a smaller group of nodes from a larger group

see http://bl.ocks.org/vicapow/6191896

Does anyone have any ideas on where this extra power could come from?

some of the things i tried that didn't work: + making alpha stay 1 + friction reduction

+4
source share
1 answer

I believe that what you see is the lack of gravity. Without gravity, the nodes will not tend to the center of the screen. I was able to get the desired result for your edge by setting force.gravity(1) and the charge for nodes to -100. https://bl.ocks.org/david4096/6264697

0
source

Source: https://habr.com/ru/post/1496499/


All Articles