echarts 饼状图legend数据显示

option = {
    title: {
        text: ''
    },
    color:['#FE7E00','#FEC400','#22DACE'],
    tooltip: {},
    legend: {
       x : '46%',
        y : '28%',
        orient : 'vertical',
        data:['aa','bb','cc'],
        formatter: function(name) {
                                var index = 0;
                                var clientlabels = ['aa','bb','cc'];
                                var clientcounts = [9,1,10];
                                clientlabels.forEach(function(value,i){
                                    if(value == name){
                                        index = i;
                                    }
                                });
                                return name + "  " + clientcounts[index];
                            }
    },
 
    calculable : false,
    series: [{
 
        name: 'myCharts',
        type: 'pie',
       radius : '50%',
        center: ['25%', '47%'],
        startAngle:90,  //开始 的旋转角度
 
        itemStyle: {
            normal: {
                label: {
                    show: false,
                    position: 'inner'
 
                },
                labelLine: {
                    show: false,
                }
            }
        },
        data: [
            {value:800, name:'aa'},
            {value:300, name:'bb'},
             {value:200, name:'cc'},
        ]
 
    }
   ]
  }
  

  

猜你喜欢

转载自www.cnblogs.com/wasbg/p/12220763.html