cancel
Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Stop rendering of vis.js graph

megan_moore
Node Link

Does anyone have enough experience with vis.js to know how to stop the nodes from continually trying to update? I have played around with the physics and stabilization settings to no avail. There are less than 1000 nodes.

4 REPLIES 4

abk
Neo4j
Neo4j

You should be able to use stopSimulation() to turn off the physics. I can't recall but there may be events which restart the simulation, like dragging a node.

Is the model never stabilizing, or is the simulation restarting after it has stabilized?

https://visjs.github.io/vis-network/docs/network/#methodPhysics

Best,
ABK

megan_moore
Node Link

The model never seems to stabilize. If I use the stopSimulation, it does stop moving, but then I can't move the nodes around. I left it running for 10 minutes and part of the graph never stops moving.

abk
Neo4j
Neo4j

Ah, I see. Stabilizing graph physics can be tricky. When developing Bloom, we had often stumbled across pathological cases where the physics creates all kinds of strange motion. Odd behavior occurs because of how the graph is interconnected and can happen even with relatively small graphs.

@jens.oknelid Do you have any tips or tricks which you could share?

-ABK

jens_oknelid
Neo4j
Neo4j

I don't have any super concrete tips without seeing what the physics is actually doing. In the past where we have had situations with nodes bouncing back and forth (like a spring that never stops) and never coming to a stop it helped with reducing the spring force of the relationships and increasing the friction. It could also help tweaking the starting positions of the nodes if that's possible to do with visjs (try making them start further apart or sort them in some way so that the forces generated in the beginning are less extreme)