爲echarts的疊加柱狀圖設置顏色

1、廢話少說,直接上代碼(前提先引入echarts先關文件)

				var myChart = echarts.init(document.getElementById('chartOne'));
					// 指定圖表的配置項和數據
					var option = {
						title: {
							text: '近'+days+'天各類型通知發佈數量',
							textStyle: {
								color: '#c23531',
								fontSize: 14
							}
						},
						tooltip : {
							trigger: 'axis',
							axisPointer : {
								type : 'shadow'
							}
						},
						legend: {
							data:['扶貧局通知','雲平臺通知','其他']
						},
						grid: {
							left: '3%',
							right: '2%',
							bottom: '3%',
							containLabel: true
						},
						xAxis : [
							{
								type : 'category',
								data : xAData //X軸座標
							}
						],
						yAxis : [
							{
								type : 'value'
							}
						],
						series : [
							{
								name:'扶貧局通知',
								type:'bar',
								//data:fu,
								data:[11,33,45],
								//設置柱體顏色
								itemStyle:{
									normal:{color:'#ab78ba'}
								}
							},
							{
								name:'雲平臺通知',
								type:'bar',
								//data:yun,
								data:[11,28,45],
								//設置柱體顏色
								itemStyle:{
									normal:{color:'#72b201'}
								}
							},
							{
								name:'其他',
								type:'bar',
								//data:qi,
								data:[22,33,66],
								//設置柱體顏色
								itemStyle:{
									normal:{color:'#08a9f2'}
								}
							}

						]
					};
					myChart.setOption(option);

2、效果截圖


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章