Gradient line
A line whose stroke runs through a colour gradient.
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
}
},
series: [
{
name: "Wind speed",
data: [15.8, 18.9, 18.2, 18.4, 20, 17.8, 15.7, 14.7, 13, 14.8, 12.5, 15.8, 16.7, 13.7, 15.6, 16.5, 17, 17.6, 17.2, 17.1, 14.8, 17.1, 19.7, 21.4]
}
],
xaxis: {
categories: ["0h", "1h", "2h", "3h", "4h", "5h", "6h", "7h", "8h", "9h", "10h", "11h", "12h", "13h", "14h", "15h", "16h", "17h", "18h", "19h", "20h", "21h", "22h", "23h"]
},
stroke: {
width: 5,
curve: "smooth"
},
fill: {
type: "gradient",
gradient: {
shade: "dark",
gradientToColors: ["#f59e0b"],
type: "horizontal",
stops: [0, 100]
}
},
colors: ["#2563eb"],
yaxis: {
title: {
text: "km/h"
}
},
title: {
text: "Wind speed over 24 hours"
},
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
}
},
series: [
{
name: "Wind speed",
data: [15.8, 18.9, 18.2, 18.4, 20, 17.8, 15.7, 14.7, 13, 14.8, 12.5, 15.8, 16.7, 13.7, 15.6, 16.5, 17, 17.6, 17.2, 17.1, 14.8, 17.1, 19.7, 21.4]
}
],
xaxis: {
categories: ["0h", "1h", "2h", "3h", "4h", "5h", "6h", "7h", "8h", "9h", "10h", "11h", "12h", "13h", "14h", "15h", "16h", "17h", "18h", "19h", "20h", "21h", "22h", "23h"]
},
stroke: {
width: 5,
curve: "smooth"
},
fill: {
type: "gradient",
gradient: {
shade: "dark",
gradientToColors: ["#f59e0b"],
type: "horizontal",
stops: [0, 100]
}
},
colors: ["#2563eb"],
yaxis: {
title: {
text: "km/h"
}
},
title: {
text: "Wind speed over 24 hours"
},
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 line-gradient-line.json --out line-gradient-line.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/line/gradient-line/index.md …