echarts

177 阅读1分钟
中间文字
    graphic: {
        type: "text",
        left: "center",
        top: "center",
        style: {
            text:"总参与人数\n100人",
            textAlign: "center",
            fill: "#000",
            width: 60,
            height: 60,
            fontSize: 20
        }
    },
   分割留白  去掉数值和线条
    series: [
        itemStyle:{
            normal: {
                borderWidth: 4,
                borderColor: '#ffffff',
            }
        },
        label: {
            show: false,
            position: 'center'
        },
        labelLine: {
            show: false
        },
    ]

axisLine:{ show:false // x y轴线 }, axisTick:{ show:false // x y轴线 刻度点 }

axisLine:{ symbol: ['none','arrow'] // 设置箭头 },

splitLine:{ show: false lineStyle:{ type:'dashed' //设置网格线类型 dotted:虚线 solid:实线 // 虚线 要先show:true }, },//去除网格线 用在y轴

axisLabel : { formatter: function(){ return ""; } } // x轴不展示数字文字

## 百分比处理 legend
 formatter: function(name) {
     let data = option.series[0].data;
     let total = 0;
     let tarValue;
     for (let i = 0, l = data.length; i < l; i++) {
         total += Number(data[i].value);
         if (data[i].name == name) {
             tarValue = Number(data[i].value);
         }
     }
     let p = total ? ((tarValue / total) * 100) : total;
     let v = p.toFixed(1)
     return  '{a|' + name + '}{c|' + v + '%}{b|' + tarValue + '}'
 },
 textStyle: {
     rich: {
         a: {
             verticalAlign: 'right',
             fontSize: 14,
             align: 'left',
             // padding:[0,28,0,0],
             width: 80
         },
         b: {
             fontSize: 14,
             align: 'left',
             padding:[0,0,0,40],
             width: 80
         },
         c: {
             fontSize: 14,
             align: 'left',
             width: 80,
             color: "rgba(0, 0, 0, 0.427450980392157)"
         }
     }
 }