Reputation: 4385
I am a little bit struggling on how to use Vis.js to only show the final result of a stabilized graph, without any stabilization animation or interaction possibilities.
Is there someone that could push me to the correct direction?
If I disable physics completely, the graph shows all nodes one overlaying the other naturally.
Thank you already!
EDIT
Here is the code that I have for the options:
Stabilization stabilization = new Stabilization();
stabilization.setFit(true);
BarnesHut barnesHut = new BarnesHut();
barnesHut.setGravitationalConstant(-23000);
barnesHut.setCentralGravity(0);
barnesHut.setSpringLength(0);
barnesHut.setSpringConstant(0.5f);
barnesHut.setDamping(1);
barnesHut.setAvoidOverlap(1);
Physics physics = new Physics();
physics.setEnabled(true);
physics.setBarnesHut(barnesHut);
physics.setSolver(Physics.Solver.barnesHut);
Smooth smooth = new Smooth();
smooth.setEnabled(false);
smooth.setType(Smooth.Type.continuous);
smooth.setRoundness(0);
Edges edges = new Edges();
edges.setSmooth(smooth);
Interaction interaction = new Interaction();
interaction.setDragNodes(false);
Options options = new Options();
options.setPhysics(physics);
options.setEdges(edges);
options.setInteraction(interaction);
Please be aware that this code is used for a wrapper around vis.js, although the options should reflect the vis.js options.
So it is ok if the answer does not contain any Java code but the actual vis.js hints, I will map it to the wrapper implementation myself.
Upvotes: 3
Views: 3201
Reputation: 4219
Seems like the animation is disabled by default, by having the stabilize
option set to true.
If you still see an animation, then try to increase the iterations
option, which is by default set to 1000
.
options.setStabilizationIterations(2000);
I have created a simple demo using the latest version of Vis.js (4.19). Bear in mind that the VisJs-Addon uses an older verion of Vis.js (3.11).
Upvotes: 1