# Basic heatmap (Heatmap example)

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

Orders by weekday and hour.

- Chart type: `heatmap` (Heatmap)
- Collection: Heatmap · Heatmap
- Raw configuration: https://westcoast-charts.com/gallery-src/heatmap/basic.js
- Standalone example: https://westcoast-charts.com/embed/samples/wcc/gallery/heatmap/basic.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: "heatmap",
    toolbar: {
      show: false
    }
  },
  yaxis: { reversed: true },
  series: [
    {
      name: "Sun",
      data: [
        {
          x: "0h",
          y: 12
        },
        {
          x: "2h",
          y: 15
        },
        {
          x: "4h",
          y: 18
        },
        {
          x: "6h",
          y: 19
        },
        {
          x: "8h",
          y: 27
        },
        {
          x: "10h",
          y: 33
        },
        {
          x: "12h",
          y: 37
        },
        {
          x: "14h",
          y: 34
        },
        {
          x: "16h",
          y: 28
        },
        {
          x: "18h",
          y: 19
        },
        {
          x: "20h",
          y: 20
        },
        {
          x: "22h",
          y: 12
        }
      ]
    },
    {
      name: "Sat",
      data: [
        {
          x: "0h",
          y: 11
        },
        {
          x: "2h",
          y: 15
        },
        {
          x: "4h",
          y: 15
        },
        {
          x: "6h",
          y: 20
        },
        {
          x: "8h",
          y: 32
        },
        {
          x: "10h",
          y: 38
        },
        {
          x: "12h",
          y: 37
        },
        {
          x: "14h",
          y: 32
        },
        {
          x: "16h",
          y: 26
        },
        {
          x: "18h",
          y: 21
        },
        {
          x: "20h",
          y: 20
        },
        {
          x: "22h",
          y: 12
        }
      ]
    },
    {
      name: "Fri",
      data: [
        {
          x: "0h",
          y: 16
        },
        {
          x: "2h",
          y: 19
        },
        {
          x: "4h",
          y: 23
        },
        {
          x: "6h",
          y: 25
        },
        {
          x: "8h",
          y: 36
        },
        {
          x: "10h",
          y: 46
        },
        {
          x: "12h",
          y: 53
        },
        {
          x: "14h",
          y: 52
        },
        {
          x: "16h",
          y: 41
        },
        {
          x: "18h",
          y: 30
        },
        {
          x: "20h",
          y: 20
        },
        {
          x: "22h",
          y: 18
        }
      ]
    },
    {
      name: "Thu",
      data: [
        {
          x: "0h",
          y: 13
        },
        {
          x: "2h",
          y: 15
        },
        {
          x: "4h",
          y: 19
        },
        {
          x: "6h",
          y: 27
        },
        {
          x: "8h",
          y: 39
        },
        {
          x: "10h",
          y: 49
        },
        {
          x: "12h",
          y: 51
        },
        {
          x: "14h",
          y: 49
        },
        {
          x: "16h",
          y: 40
        },
        {
          x: "18h",
          y: 27
        },
        {
          x: "20h",
          y: 21
        },
        {
          x: "22h",
          y: 13
        }
      ]
    },
    {
      name: "Wed",
      data: [
        {
          x: "0h",
          y: 14
        },
        {
          x: "2h",
          y: 17
        },
        {
          x: "4h",
          y: 22
        },
        {
          x: "6h",
          y: 30
        },
        {
          x: "8h",
          y: 40
        },
        {
          x: "10h",
          y: 51
        },
        {
          x: "12h",
          y: 52
        },
        {
          x: "14h",
          y: 50
        },
        {
          x: "16h",
          y: 41
        },
        {
          x: "18h",
          y: 28
        },
        {
          x: "20h",
          y: 22
        },
        {
          x: "22h",
          y: 13
        }
      ]
    },
    {
      name: "Tue",
      data: [
        {
          x: "0h",
          y: 14
        },
        {
          x: "2h",
          y: 18
        },
        {
          x: "4h",
          y: 22
        },
        {
          x: "6h",
          y: 29
        },
        {
          x: "8h",
          y: 40
        },
        {
          x: "10h",
          y: 52
        },
        {
          x: "12h",
          y: 55
        },
        {
          x: "14h",
          y: 48
        },
        {
          x: "16h",
          y: 35
        },
        {
          x: "18h",
          y: 26
        },
        {
          x: "20h",
          y: 16
        },
        {
          x: "22h",
          y: 14
        }
      ]
    },
    {
      name: "Mon",
      data: [
        {
          x: "0h",
          y: 13
        },
        {
          x: "2h",
          y: 18
        },
        {
          x: "4h",
          y: 17
        },
        {
          x: "6h",
          y: 26
        },
        {
          x: "8h",
          y: 42
        },
        {
          x: "10h",
          y: 49
        },
        {
          x: "12h",
          y: 51
        },
        {
          x: "14h",
          y: 53
        },
        {
          x: "16h",
          y: 39
        },
        {
          x: "18h",
          y: 25
        },
        {
          x: "20h",
          y: 17
        },
        {
          x: "22h",
          y: 18
        }
      ]
    }
  ],
  colors: ["#2563eb"],
  dataLabels: {
    enabled: false
  },
  title: {
    text: "Orders by weekday and hour"
  },
  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 heatmap-basic.json --out heatmap-basic.svg --with-table` (save the options above as JSON first)
