# Choropleth (Maps example)

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

Broadband adoption by country (illustrative), with a colour bar legend.

- Chart type: `map` (Map)
- Collection: Maps · Maps
- Raw configuration: https://westcoast-charts.com/gallery-src/maps/choropleth.js
- Standalone example: https://westcoast-charts.com/embed/samples/wcc/gallery/premium/maps/choropleth.html

## Setup

```js
import WestCoastCharts from 'west-coast-charts'
import types from 'west-coast-charts/types'
import premium from 'west-coast-charts/premium'
import 'west-coast-charts/maps/world-small-states' // registers the map shapes

WestCoastCharts.use(types).use(premium)
const WestCoastChartsPremium = premium
WestCoastCharts.setLicenseKey(LICENCE_KEY) // paid production licence; localhost evaluation needs no key
```

## Options

```js
const options = {
  "chart": {
    "height": 480,
    "toolbar": {
      "show": false
    },
    "type": "map"
  },
  "series": [
    {
      "name": "Adoption %",
      "data": [
        {
          "id": "DEU",
          "region": "Europe",
          "value": 79.8
        },
        {
          "id": "FRA",
          "region": "Europe",
          "value": 58
        },
        {
          "id": "GBR",
          "region": "Europe",
          "value": 39.2
        },
        {
          "id": "ITA",
          "region": "Europe",
          "value": 78.2
        },
        {
          "id": "ESP",
          "region": "Europe",
          "value": 53.2
        },
        {
          "id": "NLD",
          "region": "Europe",
          "value": 78.4
        },
        {
          "id": "BEL",
          "region": "Europe",
          "value": 63.5
        },
        {
          "id": "CHE",
          "region": "Europe",
          "value": 39.9
        },
        {
          "id": "AUT",
          "region": "Europe",
          "value": 54.6
        },
        {
          "id": "POL",
          "region": "Europe",
          "value": 62.8
        },
        {
          "id": "SWE",
          "region": "Europe",
          "value": 84.1
        },
        {
          "id": "NOR",
          "region": "Europe",
          "value": 56.1
        },
        {
          "id": "DNK",
          "region": "Europe",
          "value": 41.3
        },
        {
          "id": "FIN",
          "region": "Europe",
          "value": 40.6
        },
        {
          "id": "IRL",
          "region": "Europe",
          "value": 71.5
        },
        {
          "id": "PRT",
          "region": "Europe",
          "value": 33.1
        },
        {
          "id": "CZE",
          "region": "Europe",
          "value": 49.9
        },
        {
          "id": "HUN",
          "region": "Europe",
          "value": 44.1
        },
        {
          "id": "ROU",
          "region": "Europe",
          "value": 34.4
        },
        {
          "id": "GRC",
          "region": "Europe",
          "value": 43
        },
        {
          "id": "SVK",
          "region": "Europe",
          "value": 72.6
        },
        {
          "id": "BGR",
          "region": "Europe",
          "value": 82.3
        },
        {
          "id": "HRV",
          "region": "Europe",
          "value": 46.2
        },
        {
          "id": "SRB",
          "region": "Europe",
          "value": 82.5
        },
        {
          "id": "SVN",
          "region": "Europe",
          "value": 73.6
        },
        {
          "id": "LTU",
          "region": "Europe",
          "value": 58.7
        },
        {
          "id": "LVA",
          "region": "Europe",
          "value": 69.3
        },
        {
          "id": "EST",
          "region": "Europe",
          "value": 59.8
        },
        {
          "id": "UKR",
          "region": "Europe",
          "value": 53.4
        },
        {
          "id": "BLR",
          "region": "Europe",
          "value": 81.9
        },
        {
          "id": "ISL",
          "region": "Europe",
          "value": 44.5
        },
        {
          "id": "USA",
          "region": "North America",
          "value": 75.8
        },
        {
          "id": "CAN",
          "region": "North America",
          "value": 78.8
        },
        {
          "id": "MEX",
          "region": "North America",
          "value": 68
        },
        {
          "id": "GTM",
          "region": "North America",
          "value": 69.2
        },
        {
          "id": "CRI",
          "region": "North America",
          "value": 64.1
        },
        {
          "id": "PAN",
          "region": "North America",
          "value": 66.4
        },
        {
          "id": "CUB",
          "region": "North America",
          "value": 83.5
        },
        {
          "id": "DOM",
          "region": "North America",
          "value": 70.5
        },
        {
          "id": "BRA",
          "region": "South America",
          "value": 20.8
        },
        {
          "id": "ARG",
          "region": "South America",
          "value": 22.1
        },
        {
          "id": "CHL",
          "region": "South America",
          "value": 34.2
        },
        {
          "id": "COL",
          "region": "South America",
          "value": 25.5
        },
        {
          "id": "PER",
          "region": "South America",
          "value": 32.8
        },
        {
          "id": "URY",
          "region": "South America",
          "value": 32.8
        },
        {
          "id": "ECU",
          "region": "South America",
          "value": 18.9
        },
        {
          "id": "VEN",
          "region": "South America",
          "value": 17.3
        },
        {
          "id": "BOL",
          "region": "South America",
          "value": 21.2
        },
        {
          "id": "PRY",
          "region": "South America",
          "value": 32.2
        },
        {
          "id": "JPN",
          "region": "Asia",
          "value": 34
        },
        {
          "id": "KOR",
          "region": "Asia",
          "value": 29.6
        },
        {
          "id": "CHN",
          "region": "Asia",
          "value": 33.7
        },
        {
          "id": "IND",
          "region": "Asia",
          "value": 41
        },
        {
          "id": "IDN",
          "region": "Asia",
          "value": 29.4
        },
        {
          "id": "SGP",
          "region": "Asia",
          "value": 45
        },
        {
          "id": "MYS",
          "region": "Asia",
          "value": 46.9
        },
        {
          "id": "THA",
          "region": "Asia",
          "value": 40.1
        },
        {
          "id": "VNM",
          "region": "Asia",
          "value": 46.5
        },
        {
          "id": "PHL",
          "region": "Asia",
          "value": 46.8
        },
        {
          "id": "ISR",
          "region": "Asia",
          "value": 21.1
        },
        {
          "id": "ARE",
          "region": "Asia",
          "value": 24.7
        },
        {
          "id": "SAU",
          "region": "Asia",
          "value": 25.9
        },
        {
          "id": "TUR",
          "region": "Asia",
          "value": 26.4
        },
        {
          "id": "KAZ",
          "region": "Asia",
          "value": 35.3
        },
        {
          "id": "PAK",
          "region": "Asia",
          "value": 44.3
        },
        {
          "id": "BGD",
          "region": "Asia",
          "value": 37.9
        },
        {
          "id": "LKA",
          "region": "Asia",
          "value": 36.2
        },
        {
          "id": "AUS",
          "region": "Oceania",
          "value": 72.3
        },
        {
          "id": "NZL",
          "region": "Oceania",
          "value": 47
        },
        {
          "id": "ZAF",
          "region": "Africa",
          "value": 7.8
        },
        {
          "id": "NGA",
          "region": "Africa",
          "value": 13.1
        },
        {
          "id": "EGY",
          "region": "Africa",
          "value": 9.5
        },
        {
          "id": "KEN",
          "region": "Africa",
          "value": 8
        },
        {
          "id": "MAR",
          "region": "Africa",
          "value": 11.4
        },
        {
          "id": "GHA",
          "region": "Africa",
          "value": 13.6
        },
        {
          "id": "ETH",
          "region": "Africa",
          "value": 11.3
        },
        {
          "id": "TZA",
          "region": "Africa",
          "value": 16.8
        },
        {
          "id": "DZA",
          "region": "Africa",
          "value": 14.8
        },
        {
          "id": "TUN",
          "region": "Africa",
          "value": 15.4
        },
        {
          "id": "SEN",
          "region": "Africa",
          "value": 15.8
        },
        {
          "id": "CIV",
          "region": "Africa",
          "value": 7.9
        },
        {
          "id": "AGO",
          "region": "Africa",
          "value": 14
        }
      ]
    }
  ],
  "plotOptions": {
    "map": {
      "map": "world-small-states",
      "legend": {
        "title": "Households, %"
      }
    }
  },
  "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 maps-choropleth.json --out maps-choropleth.svg --with-table` (save the options above as JSON first)
