# Class CircularLayout

GoJS® Diagramming Components
version 3.0.14
by Northwoods Software®

#### Hierarchy

- Layout
  - CircularLayout

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.

#####
Index

### Constructors

constructor

### Accessors

actualCenter
actualSpacing
actualXRadius
actualYRadius
arrangement
aspectRatio
comparer
direction
nodeDiameterFormula
radius
sorting
spacing
startAngle
sweepAngle

### Methods

commitLayout
commitLinks
commitNodes
createNetwork
doLayout

### Properties

Ascending
BidirectionalLeft
BidirectionalRight
Circular
Clockwise
ConstantAngle
ConstantDistance
ConstantSpacing
Counterclockwise
Descending
Forwards
Optimized
Packed
Pythagorean
Reverse

#####
Inherited Index

### Accessors

Layout.arrangementOrigin
Layout.boundsComputation
Layout.diagram
Layout.group
Layout.isInitial
Layout.isOngoing
Layout.isRealtime
Layout.isRouting
Layout.isValidLayout
Layout.isViewportSized
Layout.network

### Methods

Layout.collectParts
Layout.copy
Layout.getLayoutBounds
Layout.initialOrigin
Layout.invalidateLayout
Layout.makeNetwork
Layout.updateParts

## Constructors

### constructor

- new CircularLayout(init?: Partial<CircularLayout>): CircularLayout

- Constructs a CircularLayout with no Layout.network and with no owning Layout.diagram.

  #### Parameters

  - ##### `Optional` init: Partial<CircularLayout>

    Optional initialization properties.

  #### Returns CircularLayout

## Accessors

### `Readonly` actualCenter
: Point

- This read-only property is the coordinates of the center of the laid-out ellipse immediately after the layout.

### `Readonly` actualSpacing
: number

- This read-only property is the effective spacing that may have been calculated by the layout.

### `Readonly` actualXRadius
: number

- This read-only property is the effective X radius that may have been calculated by the layout.

### `Readonly` actualYRadius
: number

- This read-only property is the effective Y radius that may have been calculated by the layout.

### arrangement
: CircularArrangement

- Gets or sets how the nodes are spaced. If arrangement === CircularArrangement.Packed, the specified radius will be ignored.

  The default value is CircularArrangement.ConstantSpacing.

### aspectRatio
: number

- Gets or sets the ratio of the arrangement's height to its width (1 for a circle, >1 for a vertically elongated ellipse).

  This is 1 by default. The value must be a positive number.

  Modifying this value changes the height, but keeps the width and the radius constant.

### comparer
: ((a: CircularVertex, b: CircularVertex) => number)

- Gets or sets the comparer which sorts the data when sorting is set to CircularSorting.Ascending or CircularSorting.Descending.

  The default function compares the Part.text values of the vertexes' LayoutVertex.nodes.

### direction
: CircularDirection

- Gets or sets whether the nodes are arranged clockwise or counterclockwise.

  The default value is CircularDirection.Clockwise.

### nodeDiameterFormula
: CircularNodeDiameterFormula

- Specifies how the diameter of nodes will be calculated. When a node is not circular, it is not clear what its diameter is.

  The default is CircularNodeDiameterFormula.Pythagorean.

### radius
: number

- Gets or sets the horizontal radius of the elliptical arrangement.

  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 === CircularArrangement.Packed. This property must always be positive or NaN.

### sorting
: CircularSorting

- Gets or sets if and how the nodes are sorted.

  CircularSorting.Forwards indicates that the nodes are arranged in the order the layout gets them. CircularSorting.Reverse indicates that the nodes are arranged in the reverse order that the layout gets them. CircularSorting.Ascending and CircularSorting.Descending indicate that the nodes will be sorted using the comparer. CircularSorting.Optimized indicates that the nodes will be arranged to minimize link crossings.

  The default value is CircularSorting.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).

  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.

  The default value is 0.

### sweepAngle
: number

- Gets or sets the absolute angle (in degrees) between the first and last node.

  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.

## Methods

### `Protected` `Override` commitLayout

- commitLayout(): void

- Position each Node according to the Vertex position, and then position the Links.

  You should not call this method -- it is a "protected virtual" method.

  #### Returns void

### `Protected` `Virtual` commitLinks

- commitLinks(): void

- 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.

  #### Returns void

### `Protected` `Virtual` commitNodes

- commitNodes(): void

- 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.

  #### Returns void

### `Override` createNetwork

- createNetwork(): CircularNetwork

- Create a new LayoutNetwork of CircularVertexes and CircularEdges.

  #### Returns CircularNetwork

  a new LayoutNetwork.

### `Override` doLayout

- doLayout(coll: Diagram | Iterable<Part> | Group): void

- Assign the positions of the vertexes in the network.

  #### Parameters

  - ##### coll: Diagram | Iterable<Part> | Group

    A Diagram or a Group or a collection of Parts.

  #### Returns void

## Properties

### `Static` `Readonly` Ascending

`deprecated`

See CircularSorting.Ascending.

### `Static` `Readonly` BidirectionalLeft

`deprecated`

See CircularDirection.BidirectionalLeft.

### `Static` `Readonly` BidirectionalRight

`deprecated`

See CircularDirection.BidirectionalRight.

### `Static` `Readonly` Circular

`deprecated`

See CircularNodeDiameterFormula.Circular.

### `Static` `Readonly` Clockwise

`deprecated`

See CircularDirection.Clockwise.

### `Static` `Readonly` ConstantAngle

`deprecated`

See CircularArrangement.ConstantAngle.

### `Static` `Readonly` ConstantDistance

`deprecated`

See CircularArrangement.ConstantDistance.

### `Static` `Readonly` ConstantSpacing

`deprecated`

See CircularArrangement.ConstantSpacing.

### `Static` `Readonly` Counterclockwise

`deprecated`

See CircularDirection.Counterclockwise.

### `Static` `Readonly` Descending

`deprecated`

See CircularSorting.Descending.

### `Static` `Readonly` Forwards

`deprecated`

See CircularSorting.Forwards.

### `Static` `Readonly` Optimized

`deprecated`

See CircularSorting.Optimized.

### `Static` `Readonly` Packed

`deprecated`

See CircularArrangement.Packed.

### `Static` `Readonly` Pythagorean

`deprecated`

See CircularNodeDiameterFormula.Pythagorean.

### `Static` `Readonly` Reverse

`deprecated`

See CircularSorting.Reverse.

Copyright © 1998-2024 by Northwoods Software Corporation.