# Column drilldown (Column example)

> WestCoast Charts 1.1.5, release, public Core release, on npm. HTML: https://westcoast-charts.com/gallery/column/column-with-drilldown/ · Index for agents: https://westcoast-charts.com/llms.txt

Click a region to see its countries, then a country to see its cities.

- Chart type: `bar` (Bar)
- Collection: Column · Column
- Raw configuration: https://westcoast-charts.com/gallery-src/column/column-with-drilldown.js
- Standalone example: https://westcoast-charts.com/embed/samples/wcc/gallery/column/column-with-drilldown.html

## Setup

```js
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)
```

## Options

```js
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()
```

## Verify

- Text check (Library 1.1.5): load `west-coast-charts/agent/describe` and call `chart.describe({ format: "json" })` for the actual drawn state. The live reader is on this example’s HTML page.
- Command line (Public agent tools 0.2.3, tested with Library 1.1.5; available from the versioned GitHub release and npm, https://westcoast-charts.com/docs/cli/index.md): `wcc chart export column-column-with-drilldown.json --out column-column-with-drilldown.svg --with-table` (save the options above as JSON first)
