关于前端:Echarts-饼图中间添加文字titlegraphic

43次阅读

共计 513 个字符,预计需要花费 2 分钟才能阅读完成。

// 指定图表的配置项和数据

    var option = {
        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b}: {c} ({d}%)"
        },
        color:["#27D9C8","#D8D8D8"],
        title:{
            text:"80%",
            left:"center",
            top:"50%",
            textStyle:{
                color:"#27D9C8",
                fontSize:36,
                align:"center"
            }
        },
        graphic:{
            type:"text",
            left:"center",
            top:"40%",
            style:{
                text:"静止达标率",
                textAlign:"center",
                fill:"#333",
                fontSize:20,
                fontWeight:700
            }
        },
        series: [
            {
                name: '静止状况',
                type: 'pie',
                radius: ['65%', '70%'],
                avoidLabelOverlap: false,
                label: {
                    normal: {
                        show: false,
                        position: 'center'
                    },
                   
                },
                
                data: [{ value: 80, name: '已实现'},
                    {value: 20, name: '未实现'},
                   
                ]
            }
        ]
    };

正文完
 0