Usage guidesLayout

Circular layout

Arrange nodes around a circle or vary the radius to form a spiral.

Overview

Arrange nodes around a circle or vary the radius to form a spiral.

When to use it

Use a circle for networks without a hierarchy, or a spiral for ordered nodes.

Basic usage

Set the layout type with layout.type.

const graph = new Graph({
  container,
  data,
  layout: { type: 'circular' },
});

Options

OptionDescriptionTypeDefault
radiusFixed circle radius. Set only the start and end radii to make a spiral.numberHalf the smaller layout dimension
startRadius, endRadiusSpiral start and end radii, used when radius is omitted.number—
clockwiseWhether to arrange nodes clockwise.booleantrue
orderingNode order by topology, directed topology, or degree.'topology' | 'topology-directed' | 'degree'Input order

Common layout options · Layout reference

Code example

Eight nodes sit on a circle with a radius of 100.

Loading example…
Drag to pan or scroll to zoom.
const layout = { type: 'circular', radius: 100 };

Spiral arrangement

Set startRadius and endRadius to different values and omit radius.

const layout = { type: 'circular', startRadius: 30, endRadius: 140 };

Compare Grid, Circular, and Dagre