javascript - d3 "end-of-ticking" event for force layout -


i'm working d3's force layout , trying find simple way identify when layout has reached steady state (i.e. when tick function has stopped manipulating position of nodes).

my definition of force looks this...

var force = d3.layout.force()         .friction(frictionvalue)          .theta(thetavalue)         //.alpha(0.1)          .size([width, height])         .gravity(gravityvalue)          .charge(chargevalue)          .on("tick", tick);  

then tick function begins...

function tick(e) { ... 

i assumed "e" key catching end-point of simulation, since i'm not explicitly passing e tick function on force definition i'm not sure represents or how might able use identify end of simulation. can either shed light on function of e (since i'm not explicitly passing value), or suggest better method simple display "alert(..)" message once force layout simulation has ended?

huge in advance @ all!

you're right, tick wrong event, want end. change last line to

.on("end", function (){     // code }); 

you can read in api documentation force layout https://github.com/mbostock/d3/wiki/force-layout


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -