layout.iterationsNumber(default: 300)

The number of times that all the forces in the diagram are being calculated and balanced. The default is set at 300, which should be enough for diagrams up to a hundred nodes. By increasing this parameter you increase the correctness of the simulation but it does not always lead to a more stable topology. In some situations a diagram simply does not have a stable minimum energy state and oscillates (globally or locally) between the minima. In such a situation increasing the iterations will not result in a better topology.

In situations where there is enough symmetry in the diagram the increased number of iterations does lead to a better layout. In the example below the 100 iterations was not enough to bring the grid to a stable state while 300 iterations did bring all the nodes in such a position that the (virtual) energy of the diagram is a minimum.

This setting is specific to the force-directed layout

Kendo UI for jQuery Diagram Increasing iterations

Example

<div id="diagram"></div>
<script>
$("#diagram").kendoDiagram({
    layout: {
        type: "force",
        iterations: 500
    },
    shapes: [
        { id: "1", x: 100, y: 100, content: { text: "Node 1" } },
        { id: "2", x: 200, y: 100, content: { text: "Node 2" } },
        { id: "3", x: 150, y: 200, content: { text: "Node 3" } }
    ],
    connections: [
        { from: "1", to: "2" },
        { from: "2", to: "3" },
        { from: "3", to: "1" }
    ]
});
</script>
In this article
layout.iterations
Not finding the help you need?
Contact Support