almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

itpwuwei opened this issue · comments

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

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.

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.