markArea: { data: [ [{ yAxis: '50', itemStyle:{ color:'#c60c30' } }, { yAxis: '60' }], [{ yAxis: '60', itemStyle:{ color:'#25C50E' } }, { yAxis: '80' }] ], }
复制
渐变色:
markArea: { data: [ [ { yAxis: '50', itemStyle: { // 看这里,加了这个属性 color: new echarts.graphic.LinearGradient( 0, 1, 0, 0, [ { offset: 0, // color: '#8bd46e' color: '#00CEFF' }, { offset: 1, // color: '#09bcb7' color: '#B5F2FF' } ], false ) } }, { yAxis: '100' } ], ... ... // 如果有多种颜色,就继续在这里写区间数组,复制上面的下来改颜色 ], }
复制
参考:
echarts图表分区域–显示不同颜色(markArea)