echarts.init(document.getElementById(‘WaterCategoryStatistics‘)).setOption({
legend: {
orient:‘vertical‘,
left:‘left‘,
data: [‘II‘, ‘III‘, ‘IV‘, ‘V‘, ‘劣V‘]
},
series: {
left:‘center‘,//离容器左侧的距离
top: ‘top‘,//距离容器上测的距离
center: [‘50%‘, ‘50%‘],
radius: ‘85%‘,
type: ‘pie‘,
data: [
{ name: ‘II‘, value: data[0].CNT },
{ name: ‘III‘, value: data[1].CNT },
{ name: ‘IV‘, value: data[2].CNT },
{ name: ‘V‘, value: data[3].CNT },
{ name: ‘劣V‘, value: data[4].CNT },
],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: ‘rgba(0, 0, 0, 0.5)‘
},
normal:{
color:function(params) {
//自定义颜色
var colorList = [
‘#00FFFF‘, ‘#00FF00‘, ‘#FFFF00‘, ‘#FF8C00‘, ‘#FF0000‘, ‘#FE8463‘,
];
return colorList[params.dataIndex]
}
}
}
}
});