一、第一种
series: [{ name: downDate[0].name, type: 'bar', data: downDate, itemStyle: { color: colors[0] }, barWidth: '30%', itemStyle: { normal: { barBorderRadius: [10, 10, 0, 0], color: new eCharts.graphic.LinearGradient( 0, 0, 0, 1, [ { offset: 0, color: '#06B5D7' }, //柱图渐变色 { offset: 1, color: '#454EF0' }, //柱图渐变色 ] ) }, } },
二、还有是这样设置的
itemStyle: { normal: { color: new eCharts.graphic.LinearGradient( 0, 0, 0, 1, [ { offset: 0, color: '#06B5D7' }, //柱图渐变色 { offset: 0.5, color: '#44C0C1' }, //柱图渐变色 { offset: 1, color: '#71C8B1' }, //柱图渐变色 ] ) }, emphasis: { color: new eCharts.graphic.LinearGradient( 0, 0, 0, 1, [ { offset: 0, color: '#71C8B1' }, //柱图高亮渐变色 { offset: 0.7, color: '#44C0C1' }, //柱图高亮渐变色 { offset: 1, color: '#06B5D7' } //柱图高亮渐变色 ] ) }