addConnection

Adds the given Connection to the diagram.

Parameters

connection Object

The Connection instance to be added to the diagram.

undoable Boolean (default:true)

Whether the addition should be recorded in the undo-redo stack.

Example - adding a Connection to the diagram

<div id="diagram"></div>
<script>
  var Shape = kendo.dataviz.diagram.Shape;
  $("#diagram").kendoDiagram();

  var diagram = $("#diagram").data("kendoDiagram");
  var shape1 = diagram.addShape( new Shape({x:100, y:100, fill: "red"}));
  var shape2 = diagram.addShape( new Shape({x:300, y:200, fill: "red"}));

  var connection = new kendo.dataviz.diagram.Connection(shape1, shape2, $.extend(true, {}, diagram.options.connectionDefaults,{ stroke: { color: "red" }}));
  diagram.addConnection(connection);
</script>
In this article