echart 饼状图自定义样式

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]
  }
 }
 }
}
});
上一篇:linux-centos系统下安装python3.5.4步骤


下一篇:java 跨域