Adds the given Connection to the diagram.


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>
  var Shape = kendo.dataviz.diagram.Shape;

  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" }}));
In this article