This question is a continuation of the previous version entitled "D3-Force update options after initializing the graph" ( D3-Force update options after graph initialization ) and what @altocumulus answered.
I am trying to update simulation simulations after changing the radius of some nodes. However, when I call forceCollideto account for changes, it does not work.
The graph is first triggered correctly using forceCollide, and the function, so that the force corresponds to the radius:
var forceCollide = d3.forceCollide()
.radius(function(d){return d.radius;})
.iterations(2)
.strength(0.95);
var simulation = d3.forceSimulation()
.velocityDecay(velocityDecay)
.force("collide", forceCollide);
Then I modify the object d.radiusand want it to forceCollidereflect the changes. However, when I call again forceCollide, it does not work:
forceCollide.radius(function(d){
d.radius;})
Any thoughts on why this is happening?