echarts 圆环图 虚线装饰 中间文字

在这里插入图片描述

let option = {
        color: ['#ff7547', '#48dc41', '#7054ff', '#ff00a8', '#0211e7', '#00a0ff'],
        tooltip: {
          trigger: 'item',
        },
        title: {
          subtext: '土地利用方式', //副标题文本
          left: 'center',
          top: '43%',
          left: '20.5%',
          subtextStyle: {
            fontFamily: '微软雅黑',
            fontSize: 13,
            color: '#fff',
          },
        },
        legend: {
          orient: 'vertical',
          type: 'scroll',
          width: '50%',
          pageIconColor: '#fff',
          pageButtonGap: 25,
          pageButtonItemGap: 25,
          pageTextStyle: {
            color: '#fff',
          },
          right: '10%',
          top: 'center',
          textStyle: {
            color: '#cad3d9',
            fontSize: 14,
          },
          formatter: function(name) {
            let data = option.series[0].data;
            // console.log(data, 'data')
            let total = 0;
            let tarValue;
            for (let i = 0; i < data.length; i++) {
              total += data[i].value;
              if (data[i].name == name) {
                tarValue = data[i].value;
              }
            }
            let p = Math.round((tarValue / total) * 100) + '%';
            return `${name}   ${p}`;
          },
          icon: 'circle',
          itemHeight: 8,
          itemWidth: 8,
        },
        series: [
          {
            name: '',
            type: 'pie',
            radius: ['55%', '65%'],
            center: ['30%', '53%'],
            data: this.pieData,
            itemStyle: {
              normal: {
                label: {
                  show: false,
                },
                labelLine: {
                  show: false,
                },
              },
            },
          },
          {
            //虚线圆环
            type: 'gauge',
            startAngle: 270,
            endAngle: -89.9999,
            center: ['30%', '53%'],
            radius: '49%',
            axisTick: {
              show: false,
            },
            axisLabel: {
              show: false,
            },
            splitNumber: 40, //虚线的个数
            axisLine: {
              show: false,
              lineStyle: {
                color: [[1, 'rgba(65, 184, 131,0.8)']],
                width: 20,
              },
            },
            splitLine: {
              length: 5, //每个虚线的宽度厚度
              lineStyle: {
                width: 3, //每个虚线的长度
                color: 'rgba(65, 184, 131,0.8)',
              }, //刻度节点线
            },
            detail: {
              show: false,
            },
          },
        ],
      };
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值