Interface used by IGraph to declare and obtain the defaults for edges and their labels and ports.
Inheritance Hierarchy
IEdgeDefaults
Remarks
Note that changing these defaults does not change properties of already created model items. Rather, only items created after the change are affected.
Examples
// the defaults for edges can be set on the IEdgeDefaults instance
// which can be retrieved from the graph's EdgeDefaults property
graph.edgeDefaults.style = new PolylineEdgeStyle({
stroke: Stroke.BLACK,
targetArrow: new Arrow(ArrowType.STEALTH),
})
// the defaults for edge labels can be set on the ILabelDefaults instance
// found at the Labels property of the edge defaults
graph.edgeDefaults.labels.layoutParameter =
new EdgeSegmentLabelModel().createParameterFromSource(0)
graph.edgeDefaults.labels.style = new LabelStyle()
Type Details
- yFiles module
- view
See Also
Properties
Gets or sets the defaults for labels at edges.
Property Value
The label defaults.
Examples
graph.edgeDefaults.labels.layoutParameter =
new EdgeSegmentLabelModel().createParameterFromSource(0)
Gets or sets the defaults for ports at edges.
Remarks
Note that these are not the defaults for the sourcePorts or targetPorts. Instead, these are the defaults for the ports in the edge's ports collection to which other edges can connect.
Property Value
The port defaults.
Examples
// don't remove node labels after their
// last adjacent edge has been removed
graph.edgeDefaults.ports.autoCleanUp = false
Gets or sets the style to use for edges.
Remarks
Depending on the setting of shareStyleInstance, the getStyleInstance method should return a clone of this instance or the very same instance.
Property Value
The style to use as a template.
Examples
graph.edgeDefaults.style = new PolylineEdgeStyle({
stroke: Stroke.BLACK,
targetArrow: new Arrow(ArrowType.STEALTH),
})
See Also
Methods
Factory method that returns a style instance for use with newly created edges.
Remarks
Most implementations will yield either a clone of or the style property, if shareStyleInstance is enabled, but they might use more complicated logic, too.
Returns
- ↪IEdgeStyle
- The style to use, which for most implementations is either a clone of or the style property, if shareStyleInstance is enabled.