1.echarts图表添加背景色。在xAxis里面添加splitArea相关属性:

splitArea: {
     show: true,
     areaStyle: {
        color: ['rgba(216,216,216,0.08)', 'rgba(216,216,216,0.04)']
      }
}

显示效果:
image.png

2.折线图中每条折线显示区域添加渐变背景色。需要在series中添加areaStyle相关属性:

areaStyle: {
     normal: {//自定义颜色,渐变色填充折线图区域
     color: new echarts.graphic.LinearGradient(0, 0, 0, 1,//变化度
     //渐变色 
     [{
            offset: 0,
     color: 'rgba(255, 255, 0, 0.12)'
     }, {
            offset: 1,
     color: color
          }]),
     },
}

下面来看最终显示效果
image.png


瑞瑞_
73 声望9 粉丝