AG Studio Launch Week 🚀🚀🚀 28 Sep - 2 Oct 2026 🚀🚀🚀 Join now

JavaScript ChartsSunburst Series

Version 14.2.0

A Sunburst Series is used to render hierarchical data structures or trees. Each node in the tree is represented by a segment on a radial circle, with the area of the sum of values.

Simple Sunburst Copy Link

The Sunburst Series is designed to display a single series and is created using the sunburst series type.

{
    series: [
        {
            type: 'sunburst',
            labelKey: 'name',
        },
    ],
}

The data passed in should be an array of nodes, with each node optionally containing children.

const data = [
    {
        name: 'Mariah Vaughan',
        children: [
            {
                name: 'Bushra Thomas',
                children: [
                    { name: 'Cyrus Henderson' },
                    { name: 'Dora Jordan' },
                    { name: 'Skyla Downs' },
                    { name: "Elissa O'Sullivan" },
                ],
            },
        ],
        // ...
    },
    {
        name: 'Nathanael Villa',
        // ...
    },
];

The labelKey defines what will appear as the title for each sector.

Sizing Copy Link

By default, the segments corresponding to leaf nodes will have the same angle.

However, the Sunburst Series is best suited to providing size values to provide relative sizing between these sectors.

The sizeKey can be used to provide a numeric value to adjust the relative sizing. Additionally, the optional sizeName property can be set to set the title that appears next to the value in tooltips.

{
    series: [
        {
            type: 'sunburst',
            labelKey: 'name',
            sizeKey: 'gdp',
            sizeName: 'GDP',
        },
    ],
}

Colour Scale Copy Link

Use colorScale to control how colorKey values map to colours.

{
    series: [
        {
            type: 'sunburst',
            labelKey: 'name',
            colorKey: 'gdpChange',
            colorName: 'Change',
            colorScale: {
                mode: 'discrete',
                fills: [
                    { color: 'tomato', stop: -0.01, name: 'Decline' },
                    { color: 'gold', stop: 0.01, name: 'Flat' },
                    { color: 'seagreen', name: 'Growth' },
                ],
            },
        },
    ],
}

In this example:

  • Use the toggle to switch between discrete mode with named stops shown in a category legend, and a continuous gradient shown in a gradient legend.

See the Colour Scale page for the full range of colour scale options including discrete mode, named stops, fixed domains, missing data, and gradient legend customisation.

Other Colours Copy Link

{
    series: [
        {
            type: 'sunburst',
            labelKey: 'name',
            sizeKey: 'gdp',
            sizeName: 'GDP',
            fills: ['#D32F2F', '#FF5722', '#283593'],
        },
    ],
}

In this configuration:

  • fills and strokes are an array of colours to use for the fills and strokes, where each node receives the colour indexed by the index of its root node

When colorScale.fills is used, the fills and strokes arrays are ignored.

Labels Copy Link

All segments can contain both labels and secondary labels, which can be shrunk to fit in the available space.

{
    series: [
        {
            type: 'sunburst',
            labelKey: 'name',
            secondaryLabelKey: 'gdpChange',
            sizeKey: 'gdp',
            sizeName: 'GDP',
            label: {
                fontSize: 14,
                minimumFontSize: 9,
                spacing: 2,
            },
            secondaryLabel: {
                formatter: ({ value }) => (value != null ? percentageFormatter.format(value) : undefined),
            },
            padding: 3,
        },
    ],
}

In this configuration:

  • fontSize sets the size of the font.
  • minimumFontSize will enable the font size to shrink down to the given value if there is not enough space.
  • spacing controls the amount of space below a label.
  • padding adds space between the edge of a sector and its contents.
  • formatter allows customising the value of a label using a function.

Inner Circle Copy Link

Provide an innerRadiusRatio to display additional information in the centre of the chart.

{
    series: [
        {
            type: 'sunburst',
            labelKey: 'name',
            sizeKey: 'budget',
            sizeName: 'Budget',
            innerRadiusRatio: 0.4,
            innerCircle: {
                fill: '#c9fdc9',
            },
            innerLabels: [
                {
                    text: 'Total Budget',
                    fontSize: 12,
                    color: 'gray',
                },
                {
                    text: '$1.3M',
                    fontSize: 24,
                    fontWeight: 'bold',
                    spacing: 6,
                },
            ],
        },
    ],
}

In this example:

  • An optional innerRadiusRatio is provided. This should be a value between 0 and 1 and defines the radius of the inner circle as a ratio of the outer radius of the series.
  • Use innerRadiusSize instead to set a fixed pixel radius.
  • The innerLabels property is used to add several lines of text into this space.
  • The colour of the centre area can be changed by using innerCircle.fill.

Highlighting Copy Link

Each sunburst highlight state exposes a separate style object.

  • highlightedItem – the hovered segment.
  • highlightedBranch – All segments that share the same root node.
  • unhighlightedItem – All segments in the highlightedBranch that are not the highlighted segment.
  • unhighlightedBranch – segments that belong to different branches.
{
    series: [
        {
            type: 'sunburst',
            labelKey: 'name',
            sizeKey: 'value',
            highlight: {
                highlightedItem: { stroke: 'green' },
                highlightedBranch: { strokeWidth: 2 },
                unhighlightedItem: { opacity: 0.5 },
                unhighlightedBranch: { opacity: 0.1 },
            },
        },
    ],
}

In this configuration:

  • Hovered segments get an accent stroke while preserving the default fill.
  • Sibling segments in the same branch inherit highlightedBranch styles (merged with their own highlight state).
  • Segments in other branches fade based on unhighlightedBranch.

Sunburst Chart Examples Copy Link

See more Sunburst Chart examples in the AG Charts Gallery.

API Reference Copy Link

Properties available on the AgSunburstSeriesOptions interface.

type required 'sunburst'
Configuration for the Sunburst Series.
innerLabels AgSunburstInnerLabel[]
Configuration for the labels at the centre of the series. Has no effect unless `innerRadiusRatio` or `innerRadiusSize` is set.
id string default: auto-generated value
Primary identifier for the series. This is provided as `seriesId` in user callbacks to differentiate multiple series. Auto-generated ids are subject to future change without warning, if your callbacks need to vary behaviour by series please supply your own unique `id` value.
context ContextDefault
Context object to use in callbacks.
data DatumDefault[]
The data to use when rendering the series. If this is not supplied, data must be set on the chart instead.
visible boolean
Whether to display the series.
cursor string
The cursor to use for hovered markers. This config is identical to the CSS `cursor` property.
nodeClickRange InteractionRange
Range from a node that a click triggers the listener.
listeners AgSeriesListeners
A map of event names to event listeners.
labelKey string
The name of the node key containing the label.
secondaryLabelKey string
The name of the node key containing a secondary label.
childrenKey string
The name of the node key containing the children. Defaults to `children`.
sizeKey string
The name of the node key containing the size value.
colorKey string
The name of the node key containing the colour value. This value (along with `colorScale` config) will be used to determine the segment colour.
sizeName string
A human-readable description of the size values. If supplied, this will be shown in the default tooltip and passed to the tooltip renderer as one of the parameters.
colorName string
A human-readable description of the colour values. If supplied, this will be shown in the default tooltip and passed to the tooltip renderer as one of the parameters.
label AgChartAutoSizedLabelOptions
Options for the label in a sector.
secondaryLabel AgChartAutoSizedSecondaryLabelOptions
Options for a secondary, smaller label in a sector - displayed under the primary label.
cornerRadius PixelSize
Apply rounded corners to each sector.
innerRadiusRatio Ratio
The ratio of the inner radius of the series. Carves a hole at the centre of the series.
innerRadiusSize PixelSize
The size in pixels of the hole carved at the centre of the series, measured outwards from the centre. Must be greater than zero, and is added to any hole `innerRadiusRatio` carves. It is not capped: a value that reaches the series radius leaves the sectors no room, so nothing is rendered.
innerCircle AgSunburstInnerCircle
Configuration for the area at the centre of the series. Has no effect unless `innerRadiusRatio` or `innerRadiusSize` is set.
sectorSpacing PixelSize
Spacing between the sectors.
padding PixelSize
Minimum distance between text and the edges of the sectors.
fills AgColorType[]
The colours to cycle through for the fills of the sectors. An array of colour strings, or fill objects for gradients, patterns, or images.
strokes CssColor[]
The colours to cycle through for the strokes of the sectors.
fillOpacity Opacity
The opacity of the fill for the sectors.
strokeOpacity Opacity
The opacity of the stroke for the sectors.
strokeWidth PixelSize
The width in pixels of the stroke for the sectors.
colorScale AgColorScale
Configuration for colour scale with fills, domain, and mode.
tooltip AgSeriesTooltip
Series-specific tooltip configuration.
itemStyler Styler
A callback function for adjusting the styles of a particular Sunburst sector based on the input parameters.
highlight AgSunburstSeriesHighlightOptions
Highlight configuration for the series.
selection AgSelectionOptions
Configuration for data selection.