New to Kendo UI for jQueryStart a free 30-day trial

ConnectionDefaults

configuration

Defines the defaults of the connections. Whenever a connection is created, the specified connectionDefaults will be used and merged with the (optional) configuration passed through the connection creation method.

<div id="diagram"></div>
<script>
  var Point = kendo.dataviz.diagram.Point;
  $("#diagram").kendoDiagram({
    shapes:[
      {
        id:"1",
        content:{
          text: "State 1"
        },
        x: 20,
        y: 20
      },
      {
        id:"2",
        content: {
          text: "State 2"
        },
        x: 160,
        y: 20
      },
      {
        id:"3",
        content: {
          text: "State 3"
        },
        x: 60,
        y: 160
      }
    ],
    connections:[
      {
        from: new Point(100,100),
        to: new Point(100,200)
      },
      {
        from: "1",
        to: "2"
      }
    ],
    connectionDefaults: {
      stroke: {
        color: "#979797",
        width: 1
      },
      type:"polyline",
      startCap: "FilledCircle",
      endCap: "ArrowEnd"
    }
  });
</script>

Defines accessibility options for connections.

<div id="diagram"></div>
<script>
$("#diagram").kendoDiagram({
    connectionDefaults: {
        accessibility: {
            role: "graphics-symbol",
            ariaRoleDescription: "Connection",
            ariaLabel: "Connects shapes in the diagram"
        }
    },
    shapes: [
        { id: "1", x: 100, y: 100, content: { text: "Shape 1" } },
        { id: "2", x: 300, y: 100, content: { text: "Shape 2" } }
    ],
    connections: [
        { from: "1", to: "2" }
    ]
});
</script>

Defines the label displayed on the connection path.

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    dataSource: [
      {id:"one", name:"One"},
      {id:"two", name:"Two"},
      {id:"five", name:"Five"},
    ],
    connectionsDataSource:[
      {from:"one", to:"two", label: "plus one"},
      {from:"one", to:"five", label: "plus three"}
    ],
    layout: "layered",
    connectionDefaults: {
      content: {
        color: "green",
        fontFamily: "Segoe UI",
        fontSize: 16,
        fontStyle: "italic",
        fontWeight: 200,
        template: "#: dataItem.label #"
      }
    }
  });
</script>

Defines the corner radius of the connection.

Default: 0

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapes:[
      {
        id:"1",
        content:{
          text: "State 1"
        },
        x: 20,
        y: 20
      },
      {
        id:"2",
        content: {
          text: "State 2"
        },
        x: 300,
        y: 100
      }
    ],
    connections:[
      {
        from: "1",
        to: "2",
        points: [
          {x: 150, y: 20},
          {x: 150, y: 150}
        ],
        type: "polyline"
      }
    ],
    connectionDefaults: {
      cornerRadius: 5
    }
  });
</script>

Defines the editing behavior of the connections.

Default: true

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    dataSource: [
      {id:"one", name:"One"},
      {id:"two", name:"Two"},
      {id:"five", name:"Five"},
    ],
    connectionsDataSource:[
      {from:"one", to:"two", label: "plus one"},
      {from:"one", to:"five", label: "plus three"}
    ],
    layout: "layered",
    connectionDefaults: {
      content: {
        template: "#: dataItem.label #"
      },
      editable: false
    }
  });
</script>

The connections end cap configuration. Can be set to a configuration object or a string that represents the endCap.type value.

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapes:[
      {
        id:"1",
        content:{
          text: "State 1"
        },
        x: 20,
        y: 20
      },
      {
        id:"2",
        content: {
          text: "State 2"
        },
        x: 200,
        y: 20
      }
    ],
    connections:[
      {
        from: "1",
        to: "2"
      }
    ],
    connectionDefaults: {
      endCap: {
        type: "FilledCircle",
        fill: {
          color: "red"
        },
        stroke: {
          color: "blue",
          width: 2
        }
      }
    }
  });
</script>

Specifies the name of the source shape connector that should be used by default. Valid values are "top", "right", "bottom", "left" and "auto".

Default: "Auto"

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapes:[
      {
        id:"1",
        content:{
          text: "State 1"
        },
        x: 20,
        y: 20
      },
      {
        id:"2",
        content: {
          text: "State 2"
        },
        x: 200,
        y: 20
      },
      {
        id:"3",
        content: {
          text: "State 3"
        },
        x: 380,
        y: 20
      }
    ],
    connections:[
      {
        from: "1",
        to: "2"
      },
      {
        from: "2",
        to: "3"
      }
    ],
    connectionDefaults: {
      fromConnector: "bottom"
    }
  });
</script>

Defines the default styling that is applied when the user hovers over a connection.

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapes:[
      {
        id:"1",
        content:{
          text: "State 1"
        },
        x: 20,
        y: 20
      },
      {
        id:"2",
        content: {
          text: "State 2"
        },
        x: 200,
        y: 20
      }
    ],
    connections:[
      {
        from: "1",
        to: "2"
      }
    ],
    connectionDefaults: {
      hover: {
        stroke: {color: "red", width: 2}
      },
      stroke: {
        color: "#979797",
        width: 4
      },
      type: "polyline",
      startCap: "FilledCircle",
      endCap: "ArrowEnd"
    }
  });
</script>

Specifies if connections can be selected.

Default: true

<div id="diagram"></div>
<script>
$("#diagram").kendoDiagram({
    connectionDefaults: {
        selectable: false
    },
    shapes: [
        { id: "1", x: 100, y: 100, content: { text: "Shape 1" } },
        { id: "2", x: 300, y: 100, content: { text: "Shape 2" } }
    ],
    connections: [
        { from: "1", to: "2" }
    ]
});
</script>

Defines the connections selection configuration.

Example - styling the connections selection
<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapes:[
      {
        id:"1",
        content:{
          text: "State 1"
        },
        x: 20,
        y: 20
      },
      {
        id:"2",
        content: {
          text: "State 2"
        },
        x: 200,
        y: 20
      }
    ],
    connections:[
      {
        from: "1",
        to: "2"
      }
    ],
    connectionDefaults: {
      type: "polyline",
      startCap: "FilledCircle",
      endCap: "ArrowEnd",
      selection: {
        handles: {
          fill: {color: "Yellow"},
          stroke: {color: "White"},
          height: 20,
          width: 20
        }
      }
    }
  });
</script>

The connection start cap configuration or type name.

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapes:[
      {
        id:"1",
        content:{
          text: "State 1"
        },
        x: 20,
        y: 20
      },
      {
        id:"2",
        content: {
          text: "State 2"
        },
        x: 200,
        y: 20
      }
    ],
    connections:[
      {
        from: "1",
        to: "2"
      }
    ],
    connectionDefaults: {
      startCap: {
        type: "FilledCircle",
        fill: {
          color: "yellow"
        },
        stroke: {
          color: "blue",
          width: 3
        }
      }
    }
  });
</script>

Defines the connection line configuration.

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapes:[
      {
        id:"1",
        content:{
          text: "State 1"
        },
        x: 20,
        y: 20
      },
      {
        id:"2",
        content: {
          text: "State 2"
        },
        x: 200,
        y: 20
      }
    ],
    connections:[
      {
        from: "1",
        to: "2"
      }
    ],
    connectionDefaults: {
      stroke: {
        color: "blue",
        width: 3
      }
    }
  });
</script>

Specifies the name of the target shape connector that should be used by default. Valid values are "top", "right", "bottom", "left" and "auto".

Default: "Auto"

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapes:[
      {
        id:"1",
        content:{
          text: "State 1"
        },
        x: 20,
        y: 20
      },
      {
        id:"2",
        content: {
          text: "State 2"
        },
        x: 200,
        y: 20
      },
      {
        id:"3",
        content: {
          text: "State 3"
        },
        x: 380,
        y: 20
      }
    ],
    connections:[
      {
        from: "1",
        to: "2"
      },
      {
        from: "2",
        to: "3"
      }
    ],
    connectionDefaults: {
      toConnector: "top"
    }
  });
</script>

Specifies the connections type. The supported values are:

  • "Polyline" - connects the defined intermediate points.
  • "Cascading" - discards given points and defines a cascading path between the endpoints.

Default: "cascading"

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    shapes:[
      {
        id:"1",
        content:{
          text: "State 1"
        },
        x: 20,
        y: 20
      },
      {
        id:"2",
        content: {
          text: "State 2"
        },
        x: 300,
        y: 100
      }
    ],
    connections:[
      {
        from: "1",
        to: "2",
        points: [
          {x: 150, y: 20},
          {x: 150, y: 150}
        ],
        type: "polyline"
      }
    ]
  });
</script>