Class CircularLayout
Extends Layout. This layout positions nodes in a circular arrangement. There are several samples that use CircularLayout. The layout cannot guarantee that it provides optimal positioning of nodes when trying to minimize link crossings.
If you want to experiment interactively with most of the properties, try the Circular Layout sample. See samples that make use of CircularLayout in the samples index.
This layout makes use of a LayoutNetwork of CircularVertexes and CircularEdges that normally correspond to the Nodes and Links of the Diagram.
Constructor Summary Details
Name | Description |
---|---|
CircularLayout()
|
Constructs a CircularLayout with no Layout.network and with no owning Layout.diagram. |
Properties Summary Details
Name, Value Type | Description |
---|---|
actualCenter
{Point}
|
This read-only property is the coordinates of the center of the laid-out ellipse after the layout. |
actualSpacing
{number}
|
This read-only property is the effective spacing that may have been calculated by the layout. |
actualXRadius
{number}
|
This read-only property is the effective X radius that may have been calculated by the layout. |
actualYRadius
{number}
|
This read-only property is the effective Y radius that may have been calculated by the layout. |
arrangement
{EnumValue}
|
Gets or sets how the nodes are spaced.More... If arrangement === CircularLayout.Packed, the specified radius will be ignored. The default value is CircularLayout.ConstantSpacing. |
aspectRatio
{number}
|
|
comparer
{function(CircularVertex, CircularVertex):number}
|
Gets or sets the comparer which sorts the data when sorting is set to CircularLayout.Ascending or CircularLayout.Descending.More... The default function compares the Part.text values of the vertexes' LayoutVertex.nodes. |
direction
{EnumValue}
|
Gets or sets whether the nodes are arranged clockwise or counterclockwise.More... The default value is CircularLayout.Clockwise. |
nodeDiameterFormula
{EnumValue}
|
Specifies how the diameter of nodes will be calculated.More... When a node is not circular, it is not clear what its diameter is. The default is CircularLayout.Pythagorean. |
radius
{number}
|
Gets or sets the horizontal radius of the elliptical arrangement.More... The default value is NaN. NaN indicates that the spacing will determine the size of the ring. If spacing is also NaN, the effective spacing will be 6. If spacing is a number, the effective radius will be > radius if and only if the spacing between elements would otherwise be less than spacing. The specified value for radius will be ignored if arrangement === CircularLayout.Packed. This property must always be positive or NaN. |
sorting
{EnumValue}
|
Gets or sets if and how the nodes are sorted.More... CircularLayout.Forwards indicates that the nodes are arranged in the order the layout gets them. CircularLayout.Reverse indicates that the nodes are arranged in the reverse order that the layout gets them. CircularLayout.Ascending and CircularLayout.Descending indicate that the nodes will be sorted using the comparer. CircularLayout.Optimized indicates that the nodes will be arranged to minimize link crossings. The default value is CircularLayout.Optimized. |
spacing
{number}
|
Gets or sets the distance between nodes (if radius is NaN) or the minimum distance between nodes (if radius is a number).More... The default value is 6. The value may be NaN. If spacing is NaN, there is no minimum spacing, allowing nodes to overlap, unless radius is NaN, in which case the effective spacing will be 6 to determine an effective radius. If spacing is a number but radius isn't, the effective spacing will be spacing, and this will determine the effective radius. If both spacing and radius are numbers, the effective radius will be at least radius, but may be larger so that the minimum spacing between nodes is spacing. |
startAngle
{number}
|
Gets or sets the angle (in degrees, clockwise from the positive side of the X axis) of the first element.More... The default value is 0. |
sweepAngle
{number}
|
Gets or sets the absolute angle (in degrees) between the first and last node.More... The default value is 360. The value must be greater than zero and less than or equal to 360. If it is not in this range, it will be automatically set to 360. Whether the arrangement is clockwise or counterclockwise does not depend on the sign of this value. The direction can be controlled by setting direction. If 360 is the specified value, the actual value will be less to keep the first and last elements from overlapping, and the spacing between the first and last nodes will be determined the same way as for all other adjacent nodes. |
- Properties borrowed from class Layout:
- arrangementOrigin, diagram, group, isInitial, isOngoing, isRealtime, isRouting, isValidLayout, isViewportSized, network
Method Summary Details
Name, Return Type | Description |
---|---|
commitLayout()
|
|
commitLinks()
|
Commit the position and routing of all edge links.More... This is called by commitLayout. This is only called if Layout.isRouting is true. Please read the Introduction page on Extensions for how to override methods and how to call this base method. |
commitNodes()
|
Commit the position of all vertex nodes.More... Please read the Introduction page on Extensions for how to override methods and how to call this base method. |
createNetwork()
{CircularNetwork}
|
Create a new LayoutNetwork of CircularVertexes and CircularEdges.
|
doLayout(coll)
|
- Methods borrowed from class Layout:
- cloneProtected, collectParts, copy, invalidateLayout, makeNetwork, updateParts
Constants Summary Details
Name | Description |
---|---|
Ascending
{EnumValue}
|
Nodes are sorted using the comparer, in ascending order; This value is used for CircularLayout.sorting. |
BidirectionalLeft
{EnumValue}
|
The ring is filled by alternating sides; the second node is counterclockwise from the first node; This value is used for CircularLayout.direction. |
BidirectionalRight
{EnumValue}
|
The ring is filled by alternating sides; the second node is clockwise from the first node; This value is used for CircularLayout.direction. |
Circular
{EnumValue}
|
The effective diameter is either the width or height of the node, whichever is larger; This will cause circular nodes to touch when CircularLayout.spacing is 0; This is ideal when the nodes are circular.More... This value is used for CircularLayout.nodeDiameterFormula. |
Clockwise
{EnumValue}
|
Rings are filled clockwise; This value is used for CircularLayout.direction. |
ConstantAngle
{EnumValue}
|
The angular distance between the nodes is constant; This value is used for CircularLayout.arrangement. |
ConstantDistance
{EnumValue}
|
The distance between the centers of the nodes is constant; This value is used for CircularLayout.arrangement. |
ConstantSpacing
{EnumValue}
|
The spacing between the idealized boundaries of the nodes is constant; This value is used for CircularLayout.arrangement. |
Counterclockwise
{EnumValue}
|
Rings are filled counterclockwise; This value is used for CircularLayout.direction. |
Descending
{EnumValue}
|
Nodes are sorted using the comparer, in reverse ascending (descending) order; This value is used for CircularLayout.sorting. |
Forwards
{EnumValue}
|
Nodes are arranged in the order given; This value is used for CircularLayout.sorting. |
Optimized
{EnumValue}
|
Nodes are ordered to reduce link crossings; This value is used for CircularLayout.sorting. |
Packed
{EnumValue}
|
The vertices are arranged as close together as possible considering the CircularLayout.spacing, assuming the nodes are rectangular; This value is used for CircularLayout.arrangement. |
Pythagorean
{EnumValue}
|
The effective diameter is sqrt(width^2+height^2); The corners of square nodes will touch at 45 degrees when CircularLayout.spacing is 0; This value is used for CircularLayout.nodeDiameterFormula. |
Reverse
{EnumValue}
|
Nodes are arranged in the reverse of the order given; This value is used for CircularLayout.sorting. |