echarts 饼图

这里写自定义目录标题

echarts 饼图

饼图加折现加内部画圆

代码

option = {
  series: [
    {
      name: 'Access From',
      type: 'pie',
      radius: [200,240],
      z:6,
      data: [
        { value: 1048, name: 'Search Engine' },
        { value: 735, name: 'Direct' },
        { value: 580, name: 'Email' },
        { value: 484, name: 'Union Ads' },
        { value: 300, name: 'Video Ads' }
      ],
      label:{
        show:true,
        alignTo: 'edge',
        formatter: '{name|{b}}\n{value|{c}}',
        lineHeight: 20,
        rich: {},
        minMargin: 5,
        edgeDistance: 10,
      },
      labelLine: {
        show: true,
        length: 60,
        lineStyle: {
          width: 2,
          color:'black'
        }
      },
      itemStyle: {
          color: 'transparent'
      },
      labelLayout: function (params) {
        const isLeft = params.labelRect.x < myChart.getWidth() / 2;
        const points = params.labelLinePoints;
        // Update the end point.
        points[2][0] = isLeft
          ? params.labelRect.x
          : params.labelRect.x + params.labelRect.width;
        return {
          labelLinePoints: points
        };
      },
    },
    {
      name: 'Access From',
      type: 'pie',
       radius: [200,280],
      z:2,
      data: [
        { value: 1048, name: 'Search Engine' },
        { value: 735, name: 'Direct' },
        { value: 580, name: 'Email' },
        { value: 484, name: 'Union Ads' },
        { value: 300, name: 'Video Ads' }
      ],
      labelLine: {
        show: false,
      },
      label:{
        show:false
      },
    },
    {
      z:7,
      name: 'Access From',
      type: 'pie',
      radius: [200,270],
      itemStyle: {
          color: 'transparent'
      },
      data: [
        { value: 1048, name: 'Search Engine' },
        { value: 735, name: 'Direct' },
        { value: 580, name: 'Email' },
        { value: 484, name: 'Union Ads' },
        { value: 300, name: 'Video Ads' }
      ],
      labelLine: {
        show: false,
      },
      label:{
        show:true,
        position: 'inside',
        formatter: '{hr|}',
        rich: {
          hr: {
            backgroundColor: '#fff',
            borderRadius:3,
            width:3,
            height:3,
            padding:[3,3,0,-12]
          },
        }
      },
    }
  ]
};

样式

在这里插入图片描述

直接放到echarts 官方实例上运行即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值