Interface used by IGraph and the like to declare and obtain the defaults for nodes and their labels or ports.
Inheritance Hierarchy
INodeDefaults
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
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.graph.INodeDefaults
See Also
Properties
Gets or sets the defaults for labels at nodes.
Gets or sets the defaults for ports at nodes.
Gets or sets the default node size.
Remarks
The values of this size will be used by createNodeAt.
Throws
- Exception({ name: 'ArgumentError' })
value
contains one or more NaN values.
Examples
// set the size of newly created nodes to 50, 30
graph.nodeDefaults.size = new Size(50, 30)
// make them appear as yellow ellipse
graph.nodeDefaults.style = new ShapeNodeStyle({
shape: ShapeNodeShape.ELLIPSE,
fill: Fill.YELLOW
})
Gets or sets the style to use for nodes.
Remarks
Depending on the setting of shareStyleInstance, the getStyleInstance method should return a clone of this instance or the very same instance.
Examples
// set the size of newly created nodes to 50, 30
graph.nodeDefaults.size = new Size(50, 30)
// make them appear as yellow ellipse
graph.nodeDefaults.style = new ShapeNodeStyle({
shape: ShapeNodeShape.ELLIPSE,
fill: Fill.YELLOW
})
See Also
Methods
Factory method that returns a style instance for use with newly created nodes.
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
- ↪INodeStyle
- The style to use, which for most implementations is either a clone of or the style property, if shareStyleInstance is enabled.