This question is a follow-up on a previous one titled "D3-Force updating parameters after initializing graph" (D3-Force updating parameters after initializing graph) and that @altocumulus answered.
I am trying to update the simulation forces after modifying the radius of some nodes. However, when I call on forceCollide
to account for the changes it does not work.
The graph first initiates correctly, using forceCollide
and a function to have the force correspond with 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);
I then modify the d.radius
object and want forceCollide
to reflect the changes. However, when I call on the forceCollide
again it does not work:
forceCollide.radius(function(d){
d.radius;})
Any thoughts on why this is happening?