比如你要改柱狀圖的漸變顏色,你就去series 系列里面找到type--bar然后里面就有修改對應的屬性,itemStyle(圖形樣式),
series: [{ name: '威脅值', type: 'bar', barWidth:70, data: [30,49,26, 60, 26], //數據 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'} //柱圖高亮漸變色 ] ) } }, }]