JavaScript/jQuery Diagram - edges
Allows you to bind the collection of diagram edges to a data source. For more information, see the Data Binding section.
dataSource
Binds the edges collection to the specified data. Specify this property if you use node and edge data sources.
The Diagram UI component creates a connector between two shapes for every edge in the collection.
fromExpr
Specifies the name of a data source field or an expression that provides an edge's start node key.
The current edge's data object.
Specify this property if you use node and edge) data sources.
$(function() { $("#diagram").dxDiagram({ nodes: { dataSource: orgItems }, edges: { dataSource: orgLinks, fromExpr: "from", toExpr: "to" }, }); });
var orgItems = [ { "id":"106", "text":"Development", "type":2 }, { "id":"108", "text":"WPF\nTeam", "type":2 }, { "id":"109", "text":"Javascript\nTeam", "type":2 }, // ... ]; var orgLinks = [ { "id":"124", "from":"106", "to":"108", }, { "id":"125", "from":"106", "to":"109", }, // ... ];
fromLineEndExpr
Specifies the name of a data source field or an expression that provides an edge's line start tip.
The current edge's data object.
The specified field or expression should return none
, arrow
, filledTriangle
, or outlinedTriangle
.
$(function() { $("#diagram").dxDiagram({ nodes: { dataSource: new DevExpress.data.ArrayStore({ key: "this", data: orgItems }), textExpr: "name", }, edges: { dataSource: new DevExpress.data.ArrayStore({ key: "this", data: orgLinks }), fromLineEndExpr: linkFromLineEndExpr, toLineEndExpr: linkToLineEndExpr }, }); function linkFromLineEndExpr(obj) { return "none"; } function linkToLineEndExpr(obj) { return "none"; } });
fromPointIndexExpr
Specifies the name of a data source field or an expression that provides an index of a shape connection point where an edge starts.
The current edge's data object.
The built-in shape's connection points are numbered clockwise from the leftmost point on the top border.
A custom shape's connection points are numbered according to their position in the connectionPoints collection.
keyExpr
Specifies the name of a data source field or an expression that provides edge keys.
The current edge's data object.
This property is required if you bind edges to a data source (edges.dataSource).
lineTypeExpr
Specifies the name of a data source field or an expression that provides an edge's line type.
The current edge's data object.
The specified field or expression should return orthogonal
or straight
.
lockedExpr
Specifies the name of a data source field or an expression whose values indicate whether an edge is locked.
The current edge's data object.
A locked item can not be moved, changed, or delete. Users can use the context menu to lock and unlock an item.
The specified field or expression should return true
or false
.
pointsExpr
Specifies the name of a data source field or an expression that provides an edge's key points.
The current edge's data object.
$(function() { $("#diagram").dxDiagram({ nodes: {...}, edges: { dataSource: new DevExpress.data.ArrayStore({ key: "this", data: orgLinks }), pointsExpr: "points", }, }); });
var orgLinks = [ { id: "1", from: "101", to: "102", points: [{x:1.5,y:1.125},{x:1.75,y:0.875},{x:2.5,y:0.875}], }, //... ];
Predefined edge points are ignored if the autoLayout.type property is set to layered or tree.
If an edge is connected to nodes, the UI component calculates coordinates of connection points and the first and last points specified in a data source are ignored.
styleExpr
Specifies the name of a data source field or an expression that provides an edge style.
The current edge's data object.
A data source field specified by this property should contain inline style declarations in string format, for instance "fill: #d9d9d9; stroke: #999999"
.
If you provide a function for the styleExpr property, the function can return style settings as CSS rules presented in JSON format as well, for instance {"fill": "#d9d9d9", "stroke": "#999999"}
textExpr
Specifies the name of a data source field or an expression that provides edge texts.
The current edge's data object.
The specified data source field or an expression should return a string or object value.
- A string specifies the text displayed in the middle of a connector.
Example:
"text"
. - An object can contain multiple texts and their positions on the connector. The position is a number from 0 to 1, where 0 corresponds to the connector's start point and 1 to the connector's end point.
Example:
{ 0.3: "text1", 0.8: "text2" }
.
textStyleExpr
Specifies the name of a data source field or an expression that provides an edge's text style.
The current edge's data object.
A data source field specified by this property must contain inline style declarations in string format, for instance "font-weight: bold; text-decoration: underline"
.
If you provide a function for the textStyleExpr property, the function can return style settings as CSS rules presented in JSON format as well, for instance { "font-weight": "bold", "text-decoration": "underline" }
.
toExpr
Specifies the name of a data source field or an expression that provides an edge's end node key.
The current edge's data object.
Specify this property if you use (node and edge) data sources.
$(function() { $("#diagram").dxDiagram({ nodes: { dataSource: orgItems }, edges: { dataSource: orgLinks, fromExpr: "from", toExpr: "to" }, }); });
var orgItems = [ { "id":"106", "text":"Development", "type":2 }, { "id":"108", "text":"WPF\nTeam", "type":2 }, { "id":"109", "text":"Javascript\nTeam", "type":2 }, // ... ]; var orgLinks = [ { "id":"124", "from":"106", "to":"108", }, { "id":"125", "from":"106", "to":"109", }, // ... ];
toLineEndExpr
Specifies the name of a data source field or an expression that provides an edge's line end tip.
The current edge's data object.
The specified field or expression should return none
, arrow
, filledTriangle
, or outlinedTriangle
.
$(function() { $("#diagram").dxDiagram({ nodes: { dataSource: new DevExpress.data.ArrayStore({ key: "this", data: orgItems }), textExpr: "name", }, edges: { dataSource: new DevExpress.data.ArrayStore({ key: "this", data: orgLinks }), fromLineEndExpr: linkFromLineEndExpr, toLineEndExpr: linkToLineEndExpr }, }); function linkFromLineEndExpr(obj) { return "none"; } function linkToLineEndExpr(obj) { return "none"; } });
toPointIndexExpr
Specifies the name of a data source field or an expression that provides an index of a shape connection point where an edge ends.
The current edge's data object.
The built-in shape's connection points are numbered clockwise from the leftmost point on the top border.
A custom shape's connection points are numbered according to their position in the connectionPoints collection.
zIndexExpr
Specifies the name of a data source field or an expression that provides an edge's z-index.
The current edge's data object.
The z-index specifies the edge stack order. An edge with greater stack order is in front of an edge with a lower stack order.
If you have technical questions, please create a support ticket in the DevExpress Support Center.