layout

Applies a layout algorithm on the current diagram.

A more detailed overview of layout and graph analysis can be found below.

Parameters

options Object

The layout options. See options.layout for a full reference.

Example - apply a layout dynamically

<button id="layoutBtn">Apply layout</button>
<div id="diagram"></div>
<script>
  $("#layoutBtn").on("click", function(){
    var diagram = $("#diagram").getKendoDiagram();
    diagram.layout({
      type: "layered"
    });
  });
  $("#diagram").kendoDiagram({
    shapes: [{
      id: "1"
    }, {
      id: "2"
    }, {
      id: "3"
    }],
    connections: [{
      from: "1",
      to: "2"
    },{
      from: "2",
      to: "3"
    }],
    connectionDefaults: {
      endCap: "ArrowEnd"
    }
  });
</script>
In this article