alignShapes

Aligns the edges (as defined by the bounding box) of the selected shapes.

Parameters

direction String

This can be one of the four supported directions:

  • "left"
  • "right"
  • "top"
  • "bottom"

Example - selecting and aligning Diagram shapes to the right

<button id="alignButton">Align 2nd and 3rd shape</button>
<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapes: [{
      id: "1",
      content: {
        text: "Monday"
      },
      x: 100,
      y: 20
    }, {
      id: "2",
      content: {
        text: "Tuesday"
      },
      x: 350,
      y: 20
    }, {
      id: "3",
      content: {
        text: "Wednesday"
      },
      x: 250,
      y: 200
    }],
    connections: [{
      from: "1",
      to: "2"
    },{
      from: "2",
      to: "3"
    }]
  });

  $("#alignButton").on("click", function(){
    var diagram = $("#diagram").getKendoDiagram();
    var shapes = diagram.shapes;
    diagram.select([shapes[1], shapes[2]]);
    diagram.alignShapes("right");
  });
</script>
In this article