Column drilldown
Click a region to see its countries, then a country to see its cities.
Open the chart without page chrome ↗
const options = {
chart: {
height: 380,
fontFamily: "Inter, Geist, \"IBM Plex Sans\", system-ui, sans-serif",
type: "bar",
toolbar: {
show: false
}
},
series: [
{
name: "Revenue k€",
data: [
{
x: "Europe",
y: 420,
drilldown: "Europe"
},
{
x: "Americas",
y: 380,
drilldown: "Americas"
},
{
x: "Asia",
y: 510,
drilldown: "Asia"
},
{
x: "Africa",
y: 140,
drilldown: "Africa"
}
]
}
],
plotOptions: {
bar: {
borderRadius: 4,
columnWidth: "50%"
}
},
dataLabels: {
enabled: false
},
drilldown: {
enabled: true,
series: [
{
id: "Europe",
name: "Europe by country",
data: [
{
x: "DE",
y: 112,
drilldown: "DE"
},
{
x: "FR",
y: 108,
drilldown: undefined
},
{
x: "ES",
y: 104,
drilldown: undefined
},
{
x: "IT",
y: 96,
drilldown: undefined
}
]
},
{
id: "DE",
name: "DE by city",
data: [
{
x: "Berlin",
y: 22
},
{
x: "Munich",
y: 40
},
{
x: "Hamburg",
y: 50
}
]
},
{
id: "Americas",
name: "Americas by country",
data: [
{
x: "US",
y: 82,
drilldown: "US"
},
{
x: "CA",
y: 60,
drilldown: undefined
},
{
x: "BR",
y: 130,
drilldown: undefined
},
{
x: "MX",
y: 108,
drilldown: undefined
}
]
},
{
id: "US",
name: "US by city",
data: [
{
x: "Austin",
y: 34
},
{
x: "Seattle",
y: 21
},
{
x: "Denver",
y: 28
}
]
},
{
id: "Asia",
name: "Asia by country",
data: [
{
x: "JP",
y: 124,
drilldown: "JP"
},
{
x: "IN",
y: 138,
drilldown: undefined
},
{
x: "KR",
y: 124,
drilldown: undefined
},
{
x: "SG",
y: 124,
drilldown: undefined
}
]
},
{
id: "JP",
name: "JP by city",
data: [
{
x: "Tokyo",
y: 27
},
{
x: "Osaka",
y: 53
},
{
x: "Nagoya",
y: 44
}
]
},
{
id: "Africa",
name: "Africa by country",
data: [
{
x: "NG",
y: 21,
drilldown: undefined
},
{
x: "ZA",
y: 46,
drilldown: undefined
},
{
x: "KE",
y: 39,
drilldown: undefined
},
{
x: "EG",
y: 34,
drilldown: undefined
}
]
}
],
animation: {
zoomFromPoint: true
}
},
title: {
text: "Revenue by region (click a column)"
},
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: "bar",
toolbar: {
show: false
}
},
series: [
{
name: "Revenue k€",
data: [
{
x: "Europe",
y: 420,
drilldown: "Europe"
},
{
x: "Americas",
y: 380,
drilldown: "Americas"
},
{
x: "Asia",
y: 510,
drilldown: "Asia"
},
{
x: "Africa",
y: 140,
drilldown: "Africa"
}
]
}
],
plotOptions: {
bar: {
borderRadius: 4,
columnWidth: "50%"
}
},
dataLabels: {
enabled: false
},
drilldown: {
enabled: true,
series: [
{
id: "Europe",
name: "Europe by country",
data: [
{
x: "DE",
y: 112,
drilldown: "DE"
},
{
x: "FR",
y: 108,
drilldown: undefined
},
{
x: "ES",
y: 104,
drilldown: undefined
},
{
x: "IT",
y: 96,
drilldown: undefined
}
]
},
{
id: "DE",
name: "DE by city",
data: [
{
x: "Berlin",
y: 22
},
{
x: "Munich",
y: 40
},
{
x: "Hamburg",
y: 50
}
]
},
{
id: "Americas",
name: "Americas by country",
data: [
{
x: "US",
y: 82,
drilldown: "US"
},
{
x: "CA",
y: 60,
drilldown: undefined
},
{
x: "BR",
y: 130,
drilldown: undefined
},
{
x: "MX",
y: 108,
drilldown: undefined
}
]
},
{
id: "US",
name: "US by city",
data: [
{
x: "Austin",
y: 34
},
{
x: "Seattle",
y: 21
},
{
x: "Denver",
y: 28
}
]
},
{
id: "Asia",
name: "Asia by country",
data: [
{
x: "JP",
y: 124,
drilldown: "JP"
},
{
x: "IN",
y: 138,
drilldown: undefined
},
{
x: "KR",
y: 124,
drilldown: undefined
},
{
x: "SG",
y: 124,
drilldown: undefined
}
]
},
{
id: "JP",
name: "JP by city",
data: [
{
x: "Tokyo",
y: 27
},
{
x: "Osaka",
y: 53
},
{
x: "Nagoya",
y: 44
}
]
},
{
id: "Africa",
name: "Africa by country",
data: [
{
x: "NG",
y: 21,
drilldown: undefined
},
{
x: "ZA",
y: 46,
drilldown: undefined
},
{
x: "KE",
y: 39,
drilldown: undefined
},
{
x: "EG",
y: 34,
drilldown: undefined
}
]
}
],
animation: {
zoomFromPoint: true
}
},
title: {
text: "Revenue by region (click a column)"
},
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 drilldown-column-with-drilldown.json --out drilldown-column-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/drilldown/column-with-drilldown/index.md …