# Per-bar colours (Timeline example)

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

Each bar picks its own colour (fillColor).

- Chart type: `rangeBar` (Range Bar)
- Collection: Timeline · Timeline / range bar
- Raw configuration: https://westcoast-charts.com/gallery-src/timeline/controlling-colors.js
- Standalone example: https://westcoast-charts.com/embed/samples/wcc/gallery/timeline/controlling-colors.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: "rangeBar",
    toolbar: {
      show: false
    }
  },
  series: [
    {
      data: [
        {
          x: "Billing API",
          y: [1767225600000, 1772323200000],
          fillColor: "#0d9488"
        },
        {
          x: "Mobile login",
          y: [1769904000000, 1777593600000],
          fillColor: "#d97706"
        },
        {
          x: "Search index",
          y: [1772323200000, 1775001600000],
          fillColor: "#0d9488"
        },
        {
          x: "Data export",
          y: [1775001600000, 1782864000000],
          fillColor: "#e11d48"
        },
        {
          x: "Audit log",
          y: [1777593600000, 1785542400000],
          fillColor: "#0d9488"
        }
      ]
    }
  ],
  plotOptions: {
    bar: {
      horizontal: true,
      distributed: true,
      borderRadius: 4,
      dataLabels: {
        hideOverflowingLabels: false
      }
    }
  },
  dataLabels: {
    enabled: true,
    formatter: (v, o) => o.w.globals.labels[o.dataPointIndex]
  },
  yaxis: {
    show: false
  },
  xaxis: {
    type: "datetime"
  },
  title: {
    text: "Workstreams by health"
  },
  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 timeline-controlling-colors.json --out timeline-controlling-colors.svg --with-table` (save the options above as JSON first)
