Donut drilldown
Click a slice to see its breakdown; the breadcrumb goes back.
Open the chart without page chrome ↗
const options = {
chart: {
height: 380,
fontFamily: "Inter, Geist, \"IBM Plex Sans\", system-ui, sans-serif",
type: "donut",
toolbar: {
show: false
}
},
series: [
{
name: "Revenue",
data: [
{
x: "Hardware",
y: 48,
drilldown: "Hardware"
},
{
x: "Software",
y: 32,
drilldown: "Software"
},
{
x: "Services",
y: 20,
drilldown: "Services"
}
]
}
],
drilldown: {
enabled: true,
series: [
{
id: "Hardware",
name: "Hardware revenue (M€)",
data: [
{
x: "Laptops",
y: 22
},
{
x: "Phones",
y: 16
},
{
x: "Monitors",
y: 10
}
]
},
{
id: "Software",
name: "Software revenue (M€)",
data: [
{
x: "Licences",
y: 18
},
{
x: "SaaS",
y: 9
},
{
x: "Add-ons",
y: 5
}
]
},
{
id: "Services",
name: "Services revenue (M€)",
data: [
{
x: "Support",
y: 12
},
{
x: "Training",
y: 8
}
]
}
]
},
legend: {
position: "bottom"
},
title: {
text: "Revenue (M€), click a slice"
},
theme: {
mode: "light",
preset: "coastal"
}
}
const chart = new WestCoastCharts(document.querySelector('#chart'), options)
chart.render()import WestCoastCharts from 'west-coast-charts'
import types from 'west-coast-charts/types'
import drilldown from 'west-coast-charts/features/drilldown'
WestCoastCharts.use(types).use(drilldown)
const options = {
chart: {
height: 380,
fontFamily: "Inter, Geist, \"IBM Plex Sans\", system-ui, sans-serif",
type: "donut",
toolbar: {
show: false
}
},
series: [
{
name: "Revenue",
data: [
{
x: "Hardware",
y: 48,
drilldown: "Hardware"
},
{
x: "Software",
y: 32,
drilldown: "Software"
},
{
x: "Services",
y: 20,
drilldown: "Services"
}
]
}
],
drilldown: {
enabled: true,
series: [
{
id: "Hardware",
name: "Hardware revenue (M€)",
data: [
{
x: "Laptops",
y: 22
},
{
x: "Phones",
y: 16
},
{
x: "Monitors",
y: 10
}
]
},
{
id: "Software",
name: "Software revenue (M€)",
data: [
{
x: "Licences",
y: 18
},
{
x: "SaaS",
y: 9
},
{
x: "Add-ons",
y: 5
}
]
},
{
id: "Services",
name: "Services revenue (M€)",
data: [
{
x: "Support",
y: 12
},
{
x: "Training",
y: 8
}
]
}
]
},
legend: {
position: "bottom"
},
title: {
text: "Revenue (M€), click a slice"
},
theme: {
mode: "light",
preset: "coastal"
}
}
const chart = new WestCoastCharts(document.querySelector('#chart'), options)
await chart.render() Waiting for the chart.
Open Data & agent view to read this chart through chart.describe().
Read from the running library through its optional agent/describe module. Text, table and JSON share the same snapshot. Demo data only.
$ wcc chart export pie-donut-with-drilldown.json --out pie-donut-with-drilldown.svg --with-table Public agent tools 0.2.3, tested with Library 1.1.5; available from the versioned GitHub release and npm. Save a JSON spec first and check the loaded runtime and supported modules before rendering. Command reference
Loading /gallery/pie/donut-with-drilldown/index.md …