A ShapeConstraint restricts the output area and shape of a layout in conjunction with organic layout algorithms such as OrganicLayout or InteractiveOrganicLayout.
Remarks
In consequence, all nodes need to be placed inside a specific restricted area.
This class cannot be instantiated
Type Details
- yFiles module
- algorithms
See Also
Constants
This ShapeConstraint does not restrict the output by any means.
Remarks
See Also
Static Methods
Creates a ShapeConstraint that confines the layout result to a rectangular area which roughly complies with the given aspect ratio.
Remarks
The aspect ratio is defined as the ratio between the width and the height of a layout.
- aspect ratio 1: width and height of the layout should be equal
- aspect ratio between 0 and 1: the height of a layout should be greater than its width
- aspect ratio larger than 1: the width of a layout should be greater than its height
The aspect ratio needs to be strictly positive.
Parameters
A map of options to pass to the method.
- ratio - number
- the preferred aspect ratio of the output
Returns
- ↪ShapeConstraint
- a ShapeConstraint imposing the given aspect ratio on the layout
Throws
- Exception({ name: 'ArgumentError' })
- if the given aspect ratio is
0
or negative
See Also
Sample Graphs
Creates a ShapeConstraint that confines the layout result to a circle.
Remarks
The actual restriction circle is defined by the given coordinates and radius.
The radius of the restriction circle needs to be greater than zero.
Parameters
A map of options to pass to the method.
- x - number
- the x-coordinate of the restriction circle's center
- y - number
- the y-coordinate of the restriction circle's center
- radius - number
- the radius of the restriction circle
Returns
- ↪ShapeConstraint
- the ShapeConstraint confining the layout to a circular area
Throws
- Exception({ name: 'ArgumentError' })
- if the given radius is less than or equal to zero
See Also
Sample Graphs
Creates a ShapeConstraint that confines the layout result to an elliptical area.
Remarks
The restriction ellipse is defined by its bounds specified by the given coordinates and size values.
The main axes of the ellipse are parallel to the coordinate axes.
The values for height and width of the ellipse's bounds need to be greater than zero.
Parameters
A map of options to pass to the method.
- x - number
- the x-coordinate of the bounds' upper left corner
- y - number
- the y-coordinate of the bounds' upper left corner
- w - number
- the width of the bounds
- h - number
- the height of the bounds
Returns
- ↪ShapeConstraint
- the ShapeConstraint confining the layout to an elliptical area
Throws
- Exception({ name: 'ArgumentError' })
- if the given width or height is
0
or negative
See Also
Sample Graphs
Creates a ShapeConstraint that confines the layout to a rectangular area.
Remarks
This restriction rectangle is defined by the given coordinates and size values.
The values for height and width of the rectangle need to be greater than zero.
Parameters
A map of options to pass to the method.
- x - number
- the x-coordinate of the restriction rectangle's upper-left corner
- y - number
- the y-coordinate of the restriction rectangle's upper-left corner
- w - number
- width of the restriction rectangle
- h - number
- height of the restriction rectangle
Returns
- ↪ShapeConstraint
- the ShapeConstraint confining the layout to a rectangular area
Throws
- Exception({ name: 'ArgumentError' })
- if the given width or height is less than or equal to zero