I am changing my layouts dynamically within transactions.
But my problem is when I change the layout from Circular to ForcedDirectedLayout or from LayeredDigraphLayout to ForcedDirectedLayout, all the nodes do no rearrange from the top or the nodes do not get distributed, instead they rearrange closer to the existing position only.
It seems odd to me that someone would want to randomize the positions when the nodes are already laid out in a reasonable fashion. There must be something specific that you are looking for. Could you please describe it?
In our app, we give the option to changes the layout for our users.
Initially, we load all our nodes using ForcedDirectedLayout, while will render all the nodes uniformly.
Once the user changes the layout to Circular, goJs renders nicely all the nodes in circular layout.
Now, if the user changes his mind and wants to see the nodes like how he did before, changing the layout from circular to forcedDirectedLayout is not helping. So, I was wondering other than saving the location of each node for each layout, is there anything I can try which goJs provides?
I suppose before a ForceDirectedLayout you could set the location of each node to (0,0).
Also you will want to set ForceDirectedLayout | GoJS API to null.