如何让echart 折线下方填充颜色

560 阅读1分钟

image.png

series: [
    {
      name: 'Email',
      type: 'line',
      stack: 'Total',
      symbol: "none",
       areaStyle: {},//默认折线下面填充颜色
      data: [120, 132, 101, 134, 90, 230, 210]
      
    },]

渐变方式

image.png

  series: [
    {
      name: 'Email',
      type: 'line',
      stack: 'Total',
      symbol: "none",
       areaStyle: {
         color: {
    type: 'linear',
    x: 0,
    y: 0,
    x2: 0,
    y2: 1,
    colorStops: [{
        offset: 0, color: 'red' // 0% 处的颜色
    }, {
        offset: 1, color: 'blue' // 100% 处的颜色
    }],
    globalCoord: false // 缺省为 false
}]