效果图
如下图所示,两种颜色可以搭配营造渐变效果:
官方文档(areaStyle > color):https://echarts.apache.org/zh/option.html#xAxis.splitArea.areaStyle.color
在series中加入以下配置代码:
// 注意: ets: echarts库(echarts下的graphic方法) // import * as ets from 'echarts' areaStyle: { color: new ets.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'green' }, { offset: 1, color: 'red' }]) },