# Colour scale (Treemap example)

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

Tiles coloured by change, red to green.

- Chart type: `treemap` (Treemap)
- Collection: Treemap · Treemap
- Raw configuration: https://westcoast-charts.com/gallery-src/treemap/color-scale.js
- Standalone example: https://westcoast-charts.com/embed/samples/wcc/gallery/treemap/color-scale.html

## Setup

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

## Options

```js
const options = {
  chart: {
    height: 380,
    fontFamily: "Inter, Geist, \"IBM Plex Sans\", system-ui, sans-serif",
    type: "treemap",
    toolbar: {
      show: false
    }
  },
  series: [
    {
      data: [
        {
          x: "Lisbon",
          y: -3.5
        },
        {
          x: "Oslo",
          y: 2.1
        },
        {
          x: "Seattle",
          y: -0.8
        },
        {
          x: "Osaka",
          y: 1.3
        },
        {
          x: "Austin",
          y: 5
        },
        {
          x: "Porto",
          y: 4.5
        },
        {
          x: "Tallinn",
          y: 2.1
        },
        {
          x: "Lyon",
          y: -6.3
        },
        {
          x: "Bergen",
          y: 1
        },
        {
          x: "Denver",
          y: 0.4
        },
        {
          x: "Kyoto",
          y: -0.5
        },
        {
          x: "Malmö",
          y: 2
        }
      ]
    }
  ],
  plotOptions: {
    treemap: {
      enableShades: false,
      colorScale: {
        ranges: [
          {
            from: -20,
            to: 0,
            color: "#e11d48"
          },
          {
            from: 0.001,
            to: 20,
            color: "#0d9488"
          }
        ]
      }
    }
  },
  dataLabels: {
    formatter: (t, o) => [t, (o.value > 0 ? '+' : '') + o.value + '%']
  },
  title: {
    text: "Weekly change by city"
  },
  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 treemap-color-scale.json --out treemap-color-scale.svg --with-table` (save the options above as JSON first)
