Per-bar colours
Each bar picks its own colour (fillColor).
Open the chart without page chrome ↗
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()import WestCoastCharts from 'west-coast-charts'
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() Waiting for the chart.
Open Data & agent view to read this chart through chart.describe().
Read from the running library through its optional agent/describe module. Text, table and JSON share the same snapshot. Demo data only.
$ wcc chart export timeline-controlling-colors.json --out timeline-controlling-colors.svg --with-table Public agent tools 0.2.3, tested with Library 1.1.5; available from the versioned GitHub release and npm. Save a JSON spec first and check the loaded runtime and supported modules before rendering. Command reference
Loading /gallery/timeline/controlling-colors/index.md …