Gradient line

A line whose stroke runs through a colour gradient.

Chart type
Line line
Tier
Free Core
Collection
Line
Render
Live, site theme
View .md Agent setup
LIVE/line/gradient-line8 of 14 in Line

Configuration

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