# City bubbles (Unit example)

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

Each city is one mark sized by population, packed by region.

- Chart type: `unit` (Unit)
- Collection: Unit · Unit & pictogram
- Raw configuration: https://westcoast-charts.com/gallery-src/unit/city-bubbles.js
- Standalone example: https://westcoast-charts.com/embed/samples/wcc/gallery/unit/city-bubbles.html

## Setup

```js
import WestCoastCharts from 'west-coast-charts'
import types from 'west-coast-charts/types'

WestCoastCharts.use(types)
```

## Options

```js
const options = {
  chart: {
    height: 420,
    fontFamily: "Inter, Geist, \"IBM Plex Sans\", system-ui, sans-serif",
    type: "unit",
    toolbar: {
      show: false
    }
  },
  series: [
    {
      name: "North",
      data: [
        {
          name: "Lisbon",
          value: 400
        },
        {
          name: "Porto",
          value: 600
        },
        {
          name: "Kyoto",
          value: 700
        },
        {
          name: "North A",
          value: 200
        },
        {
          name: "North B",
          value: 400
        },
        {
          name: "North C",
          value: 400
        }
      ]
    },
    {
      name: "South",
      data: [
        {
          name: "Oslo",
          value: 600
        },
        {
          name: "Tallinn",
          value: 200
        },
        {
          name: "Malmö",
          value: 500
        },
        {
          name: "South A",
          value: 600
        },
        {
          name: "South B",
          value: 100
        },
        {
          name: "South C",
          value: 100
        }
      ]
    },
    {
      name: "East",
      data: [
        {
          name: "Seattle",
          value: 900
        },
        {
          name: "Lyon",
          value: 900
        },
        {
          name: "East A",
          value: 800
        },
        {
          name: "East B",
          value: 600
        },
        {
          name: "East C",
          value: 700
        }
      ]
    },
    {
      name: "West",
      data: [
        {
          name: "Osaka",
          value: 200
        },
        {
          name: "Bergen",
          value: 800
        },
        {
          name: "West A",
          value: 100
        },
        {
          name: "West B",
          value: 100
        },
        {
          name: "West C",
          value: 800
        }
      ]
    },
    {
      name: "Central",
      data: [
        {
          name: "Austin",
          value: 100
        },
        {
          name: "Denver",
          value: 200
        },
        {
          name: "Central A",
          value: 100
        },
        {
          name: "Central B",
          value: 200
        },
        {
          name: "Central C",
          value: 900
        }
      ]
    }
  ],
  plotOptions: {
    unit: {
      layout: "packed",
      sizeByValue: {
        enabled: true
      }
    }
  },
  title: {
    text: "Cities sized by population (k)"
  },
  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 unit-city-bubbles.json --out unit-city-bubbles.svg --with-table` (save the options above as JSON first)
