Circular Layout
Previous
AntvDagre Layout
Next
ComboCombined Layout
Loading...
Circular layout arranges nodes evenly or at intervals on a circle, and also supports spiral layouts by configuring different startRadius and endRadius. See more circular layout examples or source code.
Circular layout:
Spiral layout:
Other settings use the default configuration (layout width and height default to the entire canvas container)
const graph = new Graph({// other configurationslayout: {type: 'circular',},});
Property | Description | Type | Default | Required |
---|---|---|---|---|
type | Layout type | circular | - | ✓ |
angleRatio | How many 2*PI between the first and last node | number | 1 | |
center | Center of the layout | [number, number]|[number, number, number] | [layout width / 2, layout height / 2] | |
clockwise | Whether to arrange clockwise | boolean | true | |
divisions | Number of segments on the ring (segments will be evenly distributed, effective when endRadius - startRadius != 0) | number | 1 | |
nodeSize | Node size (diameter), used for collision detection | Size | ((nodeData: Node) => Size) | 10 | |
nodeSpacing | Minimum spacing between rings, used to adjust radius | number | ((nodeData: Node) => number) | 10 | |
ordering | Node ordering on the ring, see details | topology | topology-directed | degree | - | |
radius | Circle radius, if set, spiral layout configs startRadius and endRadius are ignored, see details | number | - | |
startAngle | Start angle of the layout | number | 0 | |
endAngle | End angle of the layout | number | 2 * Math.PI | |
startRadius | Start radius for spiral layout, usage | number | - | |
endRadius | End radius for spiral layout | number | - | |
width | Layout width | number | canvas width | |
height | Layout height | number | canvas height |
Node ordering on the ring
topology
: topological ordertopology-directed
: topological order (directed graph)degree
: order by degreeIf not set (null
), the order in the array is used directly
If radius, startRadius, and endRadius are not set, the default is Math.min(layout width, layout height) / 2
, i.e., fills the entire layout area
const graph = new Graph({// other configurationslayout: {type: 'circular',},});
const graph = new Graph({// other configurationslayout: {type: 'circular',startRadius: 10,endRadius: 300,},});