Sunburst chart
A whole, its parts and the parts of each part, in two rings.
On this page
A sunburst shows a whole in two levels. Each series is a slice of the inner ring, its share of the whole, and its children are the slices of the outer ring over it. So a reader sees the parts and what each is made of from the middle outward. A part's children take its color in lighter steps, and the middle is kept for the readout.
Sunburst chart
<div class="card max-w(480) mx-auto"> <div class="card-header"> <h3 class="card-title">Sessions</h3> <p class="card-description">By device and system</p> </div> <figure class="chart chart-split" id="devices" style="--chart-size: 11rem"></figure></div><script>addEventListener('DOMContentLoaded', function () {MasterUI.chart(document.getElementById('devices'), { type: 'sunburst', label: 'Sessions by device and operating system, in percent', format: function (value) { return value + '%' }, series: [ { name: 'Mobile', children: [{ name: 'iOS', value: 34 }, { name: 'Android', value: 27 }] }, { name: 'Desktop', children: [{ name: 'Windows', value: 18 }, { name: 'macOS', value: 12 }, { name: 'Linux', value: 3 }] }, { name: 'Tablet', children: [{ name: 'iPadOS', value: 5 }, { name: 'Android', value: 1 }] } ]})})</script><script type="module"> import { attach } from '@master/ui/behaviors' attach()</script>import { Chart } from './ui/chart'<div className="card max-w(480) mx-auto"> <div className="card-header"> <h3 className="card-title">Sessions</h3> <p className="card-description">By device and system</p> </div> <Chart className="chart-split" id="devices" style={{ '--chart-size': '11rem' } as React.CSSProperties} type="sunburst" label="Sessions by device and operating system, in percent" format={function (value) { return value + '%' }} series={[ { name: 'Mobile', children: [{ name: 'iOS', value: 34 }, { name: 'Android', value: 27 }] }, { name: 'Desktop', children: [{ name: 'Windows', value: 18 }, { name: 'macOS', value: 12 }, { name: 'Linux', value: 3 }] }, { name: 'Tablet', children: [{ name: 'iPadOS', value: 5 }, { name: 'Android', value: 1 }] } ]} /></div><script> import Chart from './ui/Chart.svelte'</script><div class="card max-w(480) mx-auto"> <div class="card-header"> <h3 class="card-title">Sessions</h3> <p class="card-description">By device and system</p> </div> <Chart class="chart-split" id="devices" style="--chart-size: 11rem" type="sunburst" label="Sessions by device and operating system, in percent" format={function (value) { return value + '%' }} series={[ { name: 'Mobile', children: [{ name: 'iOS', value: 34 }, { name: 'Android', value: 27 }] }, { name: 'Desktop', children: [{ name: 'Windows', value: 18 }, { name: 'macOS', value: 12 }, { name: 'Linux', value: 3 }] }, { name: 'Tablet', children: [{ name: 'iPadOS', value: 5 }, { name: 'Android', value: 1 }] } ]} /></div><script setup>import Chart from './ui/Chart.vue'</script><template> <div class="card max-w(480) mx-auto"> <div class="card-header"> <h3 class="card-title">Sessions</h3> <p class="card-description">By device and system</p> </div> <Chart class="chart-split" id="devices" style="--chart-size: 11rem" type="sunburst" label="Sessions by device and operating system, in percent" :format="function (value) { return value + '%' }" :series="[ { name: 'Mobile', children: [{ name: 'iOS', value: 34 }, { name: 'Android', value: 27 }] }, { name: 'Desktop', children: [{ name: 'Windows', value: 18 }, { name: 'macOS', value: 12 }, { name: 'Linux', value: 3 }] }, { name: 'Tablet', children: [{ name: 'iPadOS', value: 5 }, { name: 'Android', value: 1 }] } ]" /> </div></template>A part is the sum of its children, unless it gives a value of its own; a part with no children is a slice of the inner ring alone. The legend names the parts, and each child says its name in the readout and in its point's name. Keep to two levels and a few children each: a third ring is not read, and a treemap holds more parts.
#Options
| Option | Default | |
|---|---|---|
label | none | What the chart shows and in what unit: the plot's accessible name |
series | [] | Each with a name and what its form reads: values, a value, points, ranges or children; optionally a category, a type, low and high, and a ring's max |
format, tickFormat | the locale's | How a value and a tick are written; xFormat for a scatter's scale across |
legend, toggle | with two series, true | Whether a legend is written, and whether its entries are checkboxes |
The readout, the keys, the legend, the colors and the scale are the same in every form: Chart holds them, with every option, class and custom property.