Echarts饼图将数据显示在 legend旁边

时间:2021-12-27 06:01:38
var client_patch_config_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'},
        ]

    }
    ]

};