Multiple y axes
Three measures with three coloured y axes.
Open the chart without page chrome ↗
const options = {
chart: {
height: 380,
fontFamily: "Inter, Geist, \"IBM Plex Sans\", system-ui, sans-serif",
type: "line",
toolbar: {
show: false
}
},
colors: ["#2563eb", "#0d9488", "#d97706"],
series: [
{
name: "Orders",
type: "column",
data: [1034, 1338, 1004, 1403, 1481, 826, 1492, 922, 987, 890]
},
{
name: "Basket €",
type: "column",
data: [43, 43, 50, 59, 42, 51, 53, 69, 51, 63]
},
{
name: "Return rate %",
type: "line",
data: [5.8, 5.9, 6.1, 6.1, 5.9, 6.4, 6.6, 6.2, 5.8, 5.2]
}
],
stroke: {
width: [0, 0, 3]
},
xaxis: {
categories: ["W1", "W2", "W3", "W4", "W5", "W6", "W7", "W8", "W9", "W10"]
},
yaxis: [
{
seriesName: "Orders",
axisBorder: {
show: true,
color: "#2563eb"
},
labels: {
style: {
colors: "#2563eb"
}
},
title: {
text: "Orders",
style: {
color: "#2563eb"
}
}
},
{
seriesName: "Basket €",
opposite: true,
axisBorder: {
show: true,
color: "#0d9488"
},
labels: {
style: {
colors: "#0d9488"
}
},
title: {
text: "Basket €",
style: {
color: "#0d9488"
}
}
},
{
seriesName: "Return rate %",
opposite: true,
axisBorder: {
show: true,
color: "#d97706"
},
labels: {
style: {
colors: "#d97706"
}
},
title: {
text: "Return %",
style: {
color: "#d97706"
}
}
}
],
dataLabels: {
enabled: false
},
title: {
text: "Shop KPIs by week"
},
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: "line",
toolbar: {
show: false
}
},
colors: ["#2563eb", "#0d9488", "#d97706"],
series: [
{
name: "Orders",
type: "column",
data: [1034, 1338, 1004, 1403, 1481, 826, 1492, 922, 987, 890]
},
{
name: "Basket €",
type: "column",
data: [43, 43, 50, 59, 42, 51, 53, 69, 51, 63]
},
{
name: "Return rate %",
type: "line",
data: [5.8, 5.9, 6.1, 6.1, 5.9, 6.4, 6.6, 6.2, 5.8, 5.2]
}
],
stroke: {
width: [0, 0, 3]
},
xaxis: {
categories: ["W1", "W2", "W3", "W4", "W5", "W6", "W7", "W8", "W9", "W10"]
},
yaxis: [
{
seriesName: "Orders",
axisBorder: {
show: true,
color: "#2563eb"
},
labels: {
style: {
colors: "#2563eb"
}
},
title: {
text: "Orders",
style: {
color: "#2563eb"
}
}
},
{
seriesName: "Basket €",
opposite: true,
axisBorder: {
show: true,
color: "#0d9488"
},
labels: {
style: {
colors: "#0d9488"
}
},
title: {
text: "Basket €",
style: {
color: "#0d9488"
}
}
},
{
seriesName: "Return rate %",
opposite: true,
axisBorder: {
show: true,
color: "#d97706"
},
labels: {
style: {
colors: "#d97706"
}
},
title: {
text: "Return %",
style: {
color: "#d97706"
}
}
}
],
dataLabels: {
enabled: false
},
title: {
text: "Shop KPIs by week"
},
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 mixed-multiple-yaxes.json --out mixed-multiple-yaxes.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/mixed/multiple-yaxes/index.md …