Per-bar colours

Each bar picks its own colour (fillColor).

Chart type
Range Bar rangeBar
Tier
Free Core
Collection
Timeline / range bar
Render
Live, site theme
View .md Agent setup
LIVE/timeline/controlling-colors5 of 5 in Timeline

Configuration

Raw Standalone
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)
chart.render()