echarts柱状图的背景色设置方法,官方推荐的例子中是又添加一组最大值来当背景(不建议),设置backgroundStyle即可:
series: [{
label: {
formatter: (params)=>{
return `${this.toThousands(params.value)}`
},
show: true,
position: 'top',
},
data: [120, 200, 150, 80, 70],
type: 'bar',
barWidth: '30%',
barGap:'-90%',
barCategoryGap :'-90%',
showBackground: true,
fontSize:'12px',
backgroundStyle: {
color: 'rgba(110, 193, 244, 0.2)',
},
}]
官网API 如下: