1

描述:当前是关于Echarts图表中的 饼图 示例。
 
            option = {
    backgroundColor: '#fff',
    legend: { show: false },
    series: [
        {
            name: '入住科室分布',
            type: 'pie',
            radius: ['0%', '60%'],
            avoidLabelOverlap: true,
            itemStyle: { borderColor: '#fff', borderWidth: 2 },
            color: [
                '#80d6f9',
                '#f7c025',
            ],
            label: {
                // alignTo: 'labelLine', // ! 文字对齐方式
                formatter: function (e) {
                    let {
                        data: { value, name, percent },
                    } = e;
                    if(name=='集团外部'){
                    return `{x|}{d|${name}}\n{bb|${value}万元}{cc|${percent}}`;

                    }else{
                        return `{x|}{a|${name}}\n{b|${value}万元}{c|${percent}}`;
                    }
                },
                minMargin: 5,
                lineHeight: 15,
                rich: {
                    x: { width: 10, height: 10, backgroundColor: 'inherit', borderRadius: 5},
                    a: { fontSize: 16, color: 'inherit', padding: [0, 20, 0, 8],fontWeight:600 },
                    b: { fontSize: 14, align: 'left', color: '#666666', padding: [18, 0, 0, 18],fontWeight:600 },
                    c: { fontSize: 14, align: 'left', color: '#666666', padding: [18, 0, 0, 8],fontWeight:600 },
                    d: { fontSize: 16,  color: 'inherit', padding: [0, 20, 0, 8],fontWeight:600 },
                    bb: { fontSize: 14, align: 'left', color: '#666666', padding: [18, 0, 0, 18],fontWeight:600 },
                    cc: { fontSize: 14, align: 'left', color: '#666666', padding: [18, 0, 0, 8],fontWeight:600 },
                },
            },
            data: [
                { value: 194.65, name: '集团外部', percent: '86%' },
                { value: 33.45, name: '集团内部', percent: '14%' },
            ],
        },
    ],
};