almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

Every time you update the "network" shape always changes, how can you make the shape unchanged? #4300

Open itpwuwei opened 5 years ago

itpwuwei commented 5 years ago

Every time you update the "network" shape always changes, how can you make the shape unchanged?

YannCami commented 5 years ago

Using network.storePositions() will put the X and Y positions of all nodes into the dataset. That way whenever the network is redrawn the nodes will stay in place.

christophe-lejeune commented 5 years ago

If your layout is not hierarchical, the randomSeed option prevents the shape to change... with no need to store the positions. Of course, this solution will not keep the shape unchanged if new nodes are added or if nodes are removed from the graph.