Echarts饼状图默认显示lable

Echarts饼状图默认显示指定lable

// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('graph-donut'));

// 指定图表的配置项和数据
option = {  
    series: [
        {
            name:'访问来源',
            type:'pie',
            radius: ['50%', '75%'],
            avoidLabelOverlap: false,
            label: {
                normal: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    show: false,
                    textStyle: {
                        fontSize: '5',
                        fontWeight: 'bold'
                    }
                }
            },
            labelLine: {
                normal: {
                    show: false
                }
            },
            data:[
                {value:335, name:'直接访问', label: {show: true , fontSize: '8',  fontWeight: 'bold'}},
                {value:310, name:'邮件营销'},
                {value:234, name:'联盟广告'}
                
            ]
        }
    ]
};

// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_18144905/article/details/83413905