javascript - Distance between clusters in d3 multi foci force layout -


i'm trying understand example of multi-foci force layout...

http://bl.ocks.org/mbostock/1804919

it contains "padding" variable (which defines distance between nodes in each cluster), i'm struggling see definition of distances between clusters comes - combination of gravity , charge maybe?!

for example, if wanted double distance between clusters how achieve that? i've played customisable values in example no avail appreciate anyone. thanks!

setting m smaller value increase distance between clusters. domain orginal scale x used initialise cx values on elements of nodes array.
calling them cx , cy little bit confusing because not cx , cy attributes of circles.
cx value each node is determined feeding random integer ordinal scale x statement cx: x(i).
circles moved toward focii calling gravity every tick (animation frame). done in following statement...

d.x += (d.cx - d.x)*alpha   

alpha fixed @ 0.5 in tick function when calling gravity, there alpha used. it's variable maintained force object set 0.1 before first tick, , reduced 1% every tick. it's passed tick function e.alpha, try passing value gravity function instead of constant 0.5. effect cause nodes "cool down" more , more gradually until stop.


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -