Interface used by IGraph to declare and obtain the defaults for edges and their labels and ports.
Inheritance Hierarchy
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()See Also
Developer's Guide
API
- edgeDefaults
Members
No filters for this type
Properties
Gets or sets the defaults for labels at edges.
Gets or sets the defaults for labels at edges.
abstract
Property Value
The label defaults.
Examples
graph.edgeDefaults.labels.layoutParameter =
new EdgeSegmentLabelModel().createParameterFromSource(0)See Also
Developer's Guide
Implemented in
EdgeDefaults.labelsGets or sets the defaults for ports at edges.
Gets or sets the defaults for ports at edges.
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.
abstract
Property Value
The port defaults.
Examples
// don't remove node labels after their
// last adjacent edge has been removed
graph.edgeDefaults.ports.autoCleanUp = falseSee Also
Developer's Guide
Implemented in
EdgeDefaults.portsabstract
Property Value
true if the reference should be shared; false otherwise.Examples
const n1 = graph.createNodeAt(new Point(0, 100))
const n2 = graph.createNodeAt(new Point(100, 0))
const n3 = graph.createNodeAt(new Point(100, 50))
const n4 = graph.createNodeAt(new Point(100, 100))
const n5 = graph.createNodeAt(new Point(100, 150))
const defaultStyle = new PolylineEdgeStyle()
graph.edgeDefaults.style = defaultStyle
// share style instances
graph.edgeDefaults.shareStyleInstance = true
const e1 = graph.createEdge(n1, n2)
const e2 = graph.createEdge(n1, n3)
// e1.style === defaultStyle; e2.style === defaultStyle; e1.style === e2.style;
defaultStyle.stroke = Stroke.RED // e1 and e2 both turn red, too
// clone style instances
graph.edgeDefaults.shareStyleInstance = false
const e3 = graph.createEdge(n1, n4)
const e4 = graph.createEdge(n1, n5)
// e3.style !== defaultStyle; e4.style !== defaultStyle; e3.style !== e4.style;
defaultStyle.stroke = Stroke.YELLOW // e3 and e4 don't change their colorSee Also
Implemented in
EdgeDefaults.shareStyleInstanceGets or sets the style to use for edges.
Gets or sets the style to use for edges.
Depending on the setting of shareStyleInstance, the getStyleInstance method should return a clone of this instance or the very same instance.
abstract
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
Implemented in
EdgeDefaults.styleMethods
Factory method that returns a style instance for use with newly created edges.
Factory method that returns a style instance for use with newly created edges.
Most implementations will yield either a clone of or the style property, if shareStyleInstance is enabled, but they might use more complicated logic, too.
abstract
Return Value
- IEdgeStyle
- The style to use, which for most implementations is either a clone of or the style property, if shareStyleInstance is enabled.