CircularLayout class

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.

Implemented types
Available extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

CircularLayout([dynamic init])
factory

Properties

actualCenter Point

Available on CircularLayout, provided by the CircularLayout$Typings extension

This read-only property is the coordinates of the center of the laid-out ellipse immediately after the layout.
getter/setter pair
actualSpacing num

Available on CircularLayout, provided by the CircularLayout$Typings extension

This read-only property is the effective spacing that may have been calculated by the layout.
getter/setter pair
actualXRadius num

Available on CircularLayout, provided by the CircularLayout$Typings extension

This read-only property is the effective X radius that may have been calculated by the layout.
getter/setter pair
actualYRadius num

Available on CircularLayout, provided by the CircularLayout$Typings extension

This read-only property is the effective Y radius that may have been calculated by the layout.
getter/setter pair
arrangement EnumValue

Available on CircularLayout, provided by the CircularLayout$Typings extension

Gets or sets how the nodes are spaced. If #arrangement === CircularLayout.Packed, the specified #radius will be ignored.
getter/setter pair
arrangementOrigin Point

Available on Layout, provided by the Layout$Typings extension

Gets or sets the top-left point for where the graph should be positioned when laid out. The default value for this property is the Point(0, 0). Setting this property to a new value invalidates this layout. This property is likely to be set by many Layouts that belong to a Group when the layout is performed.
getter/setter pair
aspectRatio num

Available on CircularLayout, provided by the CircularLayout$Typings extension

Gets or sets the ratio of the arrangement's height to its width (1 for a circle, >1 for a vertically elongated ellipse).
getter/setter pair
boundsComputation Rect Function(Part, Layout, Rect)?

Available on Layout, provided by the Layout$Typings extension

Gets or sets a function that determines the initial size and position in document coordinates of a LayoutVertex corresponding to a Node. This function is called by #getLayoutBounds. The default value for this property is null, in which case the GraphObject#actualBounds of the Node is used. Setting this property to a new value invalidates this layout.
getter/setter pair
comparer num Function(CircularVertex, CircularVertex)

Available on CircularLayout, provided by the CircularLayout$Typings extension

Gets or sets the comparer which sorts the data when #sorting is set to CircularLayout.Ascending or CircularLayout.Descending.
getter/setter pair
diagram Diagram?

Available on Layout, provided by the Layout$Typings extension

Gets the Diagram that owns this layout, if it is the value of Diagram#layout.
getter/setter pair
direction EnumValue

Available on CircularLayout, provided by the CircularLayout$Typings extension

Gets or sets whether the nodes are arranged clockwise or counterclockwise.
getter/setter pair
group Group?

Available on Layout, provided by the Layout$Typings extension

Gets the Group that uses this layout, if it is the value of a group's Group#layout.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isInitial bool

Available on Layout, provided by the Layout$Typings extension

Gets or sets whether this layout is performed on an initial layout. The default value is true. Setting this property to false causes #isValidLayout to be set to true so that the diagram does not perform this layout.
getter/setter pair
isOngoing bool

Available on Layout, provided by the Layout$Typings extension

Gets or sets whether this layout can be invalidated by #invalidateLayout. Set this to false to prevent actions such as adding or removing Parts from invalidating this layout. The default value is true. Setting this property does not invalidate this layout.
getter/setter pair
isRealtime bool?

Available on Layout, provided by the Layout$Typings extension

Gets or sets whether this layout be performed in real-time, before the end of a transaction. All layouts that are invalidated will be performed at the end of a transaction. The default value is null. A null value is treated as true for a Diagram#layout but false for a Group#layout. Setting this property does not invalidate this layout.
getter/setter pair
isRouting bool

Available on Layout, provided by the Layout$Typings extension

Gets or sets whether this layout routes Links. The default value is true. When false, this layout will not explicitly set the Link#points, and the default routing of each individual Link will take place after the Nodes are moved by #commitLayout. Setting this property does not invalidate this layout.
getter/setter pair
isValidLayout bool

Available on Layout, provided by the Layout$Typings extension

Gets or sets whether this layout needs to be performed again (if false). Instead of setting this property directly, it is normal to set it to false by calling #invalidateLayout, since that also requests performing a layout in the near future.
getter/setter pair
isViewportSized bool

Available on Layout, provided by the Layout$Typings extension

Gets or sets whether this layout depends on the Diagram#viewportBounds's size. If set to true, the layout will invalidate when the Diagram's viewport changes size. This only applies to diagram layouts, not to group layouts, and only when Diagram#autoScale is set to Diagram.None.
getter/setter pair
network LayoutNetwork?

Available on Layout, provided by the Layout$Typings extension

Gets or sets the LayoutNetwork used by this Layout, if any. The default value is null. Setting this property does not invalidate this layout. Not all kinds of layout make use of a LayoutNetwork. Call #createNetwork or #makeNetwork to create a network.
getter/setter pair
nodeDiameterFormula EnumValue

Available on CircularLayout, provided by the CircularLayout$Typings extension

Specifies how the diameter of nodes will be calculated. When a node is not circular, it is not clear what its diameter is.
getter/setter pair
radius num

Available on CircularLayout, provided by the CircularLayout$Typings extension

Gets or sets the horizontal radius of the elliptical arrangement.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sorting EnumValue

Available on CircularLayout, provided by the CircularLayout$Typings extension

Gets or sets if and how the nodes are sorted.
getter/setter pair
spacing num

Available on CircularLayout, provided by the CircularLayout$Typings extension

Gets or sets the distance between nodes (if #radius is NaN) or the minimum distance between nodes (if #radius is a number).
getter/setter pair
startAngle num

Available on CircularLayout, provided by the CircularLayout$Typings extension

Gets or sets the angle (in degrees, clockwise from the positive side of the X axis) of the first element.
getter/setter pair
sweepAngle num

Available on CircularLayout, provided by the CircularLayout$Typings extension

Gets or sets the absolute angle (in degrees) between the first and last node.
getter/setter pair

Methods

cloneProtected(Layout copy) → void

Available on Layout, provided by the Layout$Typings extension

Copies properties from this object to the given object, which is of the same class. This is called by #copy and should be overridden for each class that adds properties. There are examples of such overrides in the samples. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
collectParts(Object coll) Set<Part>

Available on Layout, provided by the Layout$Typings extension

A convenient way of converting the Diagram|Group|Iterable argument to doLayout to an actual collection of eligible Parts. The resulting Set will not include any Nodes or Links for which Part#canLayout is false. If the argument includes a Group for which Group#layout is null, the resulting Set will include the member parts of that group rather than that group itself. You will not need to call collectParts if you call #makeNetwork, because that method does effectively the same thing when building the LayoutNetwork.
commitLayout() → void

Available on CircularLayout, provided by the CircularLayout$Typings extension

Position each Node according to the Vertex position, and then position the Links.
commitLayout() → void

Available on Layout, provided by the Layout$Typings extension

When using a LayoutNetwork, commit changes to the diagram by setting Node positions and by routing the Links. This is called by #updateParts within a transaction.

Available on CircularLayout, provided by the CircularLayout$Typings extension

Commit the position and routing of all edge links. 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() → void

Available on CircularLayout, provided by the CircularLayout$Typings extension

Commit the position of all vertex nodes. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
copy() Layout

Available on Layout, provided by the Layout$Typings extension

Creates a copy of this Layout and returns it. When a Group is copied that has a Group#layout, the Layout must also be copied. This calls #cloneProtected on a newly constructed Layout. @expose @return {Layout}
createNetwork() CircularNetwork

Available on CircularLayout, provided by the CircularLayout$Typings extension

Create a new LayoutNetwork of CircularVertexes and CircularEdges. @return {CircularNetwork} a new LayoutNetwork.
createNetwork() LayoutNetwork

Available on Layout, provided by the Layout$Typings extension

Create a new LayoutNetwork of LayoutVertexes and LayoutEdges. This may be overridden in Layout subclasses to create instances of subclasses of LayoutNetwork. Please read the Introduction page on Extensions for how to override methods and how to call this base method. @expose @return {LayoutNetwork} a new LayoutNetwork.
doLayout(Object coll) → void

Available on CircularLayout, provided by the CircularLayout$Typings extension

Assign the positions of the vertexes in the network. @param {Diagram|Group|Iterable.
doLayout(Object coll) → void

Available on Layout, provided by the Layout$Typings extension

Position all of the nodes that do not have an assigned Part#location in the manner of a simple rectangular array. The default implementation ignores all Groups and Links; many subclasses of Layout ignore all instances of Parts that are not Nodes or Links.
getLayoutBounds(Part part, [Rect? rect]) Rect

Available on Layout, provided by the Layout$Typings extension

This method is called by layouts to determine the size and initial position of the nodes that it is laying out. Normally this just returns the part's GraphObject#actualBounds. However, if #boundsComputation has been set to a function, that function will be called in order to return the bounds of the given Part in document coordinates that the layout should pretend it has. @param {Part} part the Part being laid out @param {Rect=} rect an optional Rect that will be modified and returned @return {Rect} a Rect in document coordinates @since 2.0
initialOrigin(Point origin) Point

Available on Layout, provided by the Layout$Typings extension

Compute the desired value of #arrangementOrigin if this Layout is being performed for a Group. This is typically called near the beginning of the implementation of #doLayout: this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin); if the layout wants to respect the pre-layout location of the Group when deciding where to position its member nodes.
invalidateLayout() → void

Available on Layout, provided by the Layout$Typings extension

If #isOngoing is true and if an initial layout has not yet been performed, set the #isValidLayout property to false, and ask to perform another layout in the near future. If #isInitial is true, this layout is invalidated only when the Diagram#model is replaced, not under the normal circumstances such as when parts are added or removed or due to other calls to Layout#invalidateLayout.
makeNetwork(Object coll) LayoutNetwork

Available on Layout, provided by the Layout$Typings extension

Create and initialize a LayoutNetwork with the given nodes and links. This should be called by #doLayout when this layout uses a #network. This method calls #createNetwork to allocate the network. This may be overridden in Layout subclasses to customize the initialization. Please read the Introduction page on Extensions for how to override methods and how to call this base method. @expose @param {Diagram|Group|Iterable.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateParts() → void

Available on Layout, provided by the Layout$Typings extension

When using a LayoutNetwork, update the "physical" node positionings and link routings. This should be called by #doLayout when this layout uses a #network. This calls #commitLayout to actually set Node positions and route Links. This performs the changes within a transaction. Please read the Introduction page on Extensions for how to override methods and how to call this base method. @expose

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

ascending EnumValue
Nodes are sorted using the #comparer, in ascending order; This value is used for CircularLayout#sorting.
getter/setter pair
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.
getter/setter pair
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.
getter/setter pair
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. This value is used for CircularLayout#nodeDiameterFormula.
getter/setter pair
clockwise EnumValue
Rings are filled clockwise; This value is used for CircularLayout#direction.
getter/setter pair
constantAngle EnumValue
The angular distance between the nodes is constant; This value is used for CircularLayout#arrangement.
getter/setter pair
constantDistance EnumValue
The distance between the centers of the nodes is constant; This value is used for CircularLayout#arrangement.
getter/setter pair
constantSpacing EnumValue
The spacing between the idealized boundaries of the nodes is constant; This value is used for CircularLayout#arrangement.
getter/setter pair
counterclockwise EnumValue
Rings are filled counterclockwise; This value is used for CircularLayout#direction.
getter/setter pair
descending EnumValue
Nodes are sorted using the #comparer, in reverse ascending (descending) order; This value is used for CircularLayout#sorting.
getter/setter pair
forwards EnumValue
Nodes are arranged in the order given; This value is used for CircularLayout#sorting.
getter/setter pair
optimized EnumValue
Nodes are ordered to reduce link crossings; This value is used for CircularLayout#sorting.
getter/setter pair
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.
getter/setter pair
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.
getter/setter pair
reverse EnumValue
Nodes are arranged in the reverse of the order given; This value is used for CircularLayout#sorting.
getter/setter pair