Class: mxEdgeStyle
Provides various edge styles to be used as the values for <mxConstants.STYLE_EDGE> in a cell style.
Example:
(code) var style = stylesheet.getDefaultEdgeStyle(); style[mxConstants.STYLE_EDGE] = mxEdgeStyle.ElbowConnector; (end)
Sets the default edge style to
Custom edge style:
To write a custom edge style, a function must be added to the mxEdgeStyle object as follows:
(code) mxEdgeStyle.MyStyle = function(state, source, target, points, result) { if (source != null && target != null) { var pt = new mxPoint(target.getCenterX(), source.getCenterY());
if (mxUtils.contains(source, pt.x, pt.y))
{
pt.y = source.y + source.height;
}
result.push(pt);
} }; (end)
In the above example, a right angle is created using a point on the horizontal center of the target vertex and the vertical center of the source vertex. The code checks if that point intersects the source vertex and makes the edge straight if it does. The point is then added into the result array, which acts as the return value of the function.
The new edge style should then be registered in the
The custom edge style above can now be used in a specific edge as follows:
(code) model.setStyle(edge, 'edgeStyle=myEdgeStyle'); (end)
Note that the key of the
Or it can be used for all edges in the graph as follows:
(code) var style = graph.getStylesheet().getDefaultEdgeStyle(); style[mxConstants.STYLE_EDGE] = mxEdgeStyle.MyStyle; (end)
Note that the object can be used directly when programmatically setting
the value, but the key in the
Function: EntityRelation
Implements an entity relation style for edges (as used in database schema diagrams). At the time the function is called, the result array contains a placeholder (null) for the first absolute point, that is, the point where the edge and source terminal are connected. The implementation of the style then adds all intermediate waypoints except for the last point, that is, the connection point between the edge and the target terminal. The first ant the last point in the result array are then replaced with mxPoints that take into account the terminal's perimeter and next point on the edge.
Parameters:
state -
Function: Loop
Implements a self-reference, aka. loop.
Function: OrthConnector
Implements a local orthogonal router between the given cells.
Parameters:
state -
Function: SegmentConnector
Implements an orthogonal edge style. Use
Function: SideToSide
Implements a vertical elbow edge. See
Function: TopToBottom
Implements a horizontal elbow edge. See
Generated using TypeDoc
Function: ElbowConnector
Uses either or depending on the horizontal
flag in the cell style. is used if horizontal is true or
unspecified. See for a description of the
parameters.