echarts 星轨饼图

echarts 星轨饼图

效果:

在这里插入图片描述

代码:

下面展示一些 代码片

let angle = 0;
option = {
  backgroundColor: '#140a69',
  color: ['#7D5AFB', '#FC8F00', '#01D5F3', '#3B8CFF'],
  series: [
    {
      animation: false,
      type: 'pie',
      silent: true,
      radius: ['0%', '50%'],
      hoverAnimation: false,
      color: '#131415',
      label: {
        normal: {
          show: false
        }
      },
      labelLine: {
        normal: {
          show: false
        }
      },
      data: [1]
    },
    {
      name: 'ring5',
      type: 'custom',
      coordinateSystem: 'none',
      zlevel: 2,
      renderItem: function (params, api) {
        let x0 = api.getWidth() / 2;
        let y0 = api.getHeight() / 2;
        let r = (Math.min(api.getWidth(), api.getHeight()) / 1.8) * 0.4;
        let point = getCirlPoint(x0, y0, r, 90 + -angle);
        return {
          type: 'circle',
          shape: {
            cx: point.x,
            cy: point.y,
            r: 8
          },
          style: {
            stroke: '#0B44B5', 
            fill: '#0E5FFF'
          },
          silent: true
        };
      },
      data: [0]
    },
    {
      name: 'ring5',
      type: 'custom',
      coordinateSystem: 'none',
      zlevel: 2,
      renderItem: function (params, api) {
        let x0 = api.getWidth() / 2;
        let y0 = api.getHeight() / 2;
        let r = (Math.min(api.getWidth(), api.getHeight()) / 1.8) * 0.4;
        let point = getCirlPoint(x0, y0, r, 20 + -angle);
        return {
          type: 'circle',
          shape: {
            cx: point.x,
            cy: point.y,
            r: 4
          },
          style: {
            stroke: '#0B44B5', 
            fill: '#00D1C8'
          },
          silent: true
        };
      },
      data: [0]
    },
    {
      name: 'ring5',
      type: 'custom',
      coordinateSystem: 'none',
      zlevel: 2,
      renderItem: function (params, api) {
        let x0 = api.getWidth() / 2;
        let y0 = api.getHeight() / 2;
        let r = (Math.min(api.getWidth(), api.getHeight()) / 2.3) * 0.4;
        let point = getCirlPoint(x0, y0, r, 190 + -angle);
        return {
          type: 'circle',
          shape: {
            cx: point.x,
            cy: point.y,
            r: 4
          },
          style: {
            stroke: 'rgba(7, 186, 116, 0.5)',
            fill: 'rgba(254, 219, 101, 0.8)'
          },
          silent: true
        };
      },
      data: [0]
    },
    {
      name: 'ring5',
      type: 'custom',
      coordinateSystem: 'none',
      zlevel: 2,
      renderItem: function (params, api) {
        let x0 = api.getWidth() / 2;
        let y0 = api.getHeight() / 2;
        let r = (Math.min(api.getWidth(), api.getHeight()) / 2.3) * 0.4;
        let point = getCirlPoint(x0, y0, r, 300 + -angle);
        return {
          type: 'circle',
          shape: {
            cx: point.x,
            cy: point.y,
            r: 6
          },
          style: {
            stroke: 'rgba(14, 95, 255, 0.8)', 
            fill: 'rgba(11, 68, 181, 0.9)'
          },
          silent: true
        };
      },
      data: [0]
    },
    {
      name: 'ring5',
      type: 'custom',
      zlevel: 1,
      coordinateSystem: 'none',
      renderItem: function (params, api) {
        return {
          type: 'arc',
          shape: {
            cx: api.getWidth() / 2,
            cy: api.getHeight() / 2,
            r: (Math.min(api.getWidth(), api.getHeight()) / 2.3) * 0.4,
            startAngle: 0,
            endAngle: 360
          },
          style: {
            stroke: 'rgba(14, 95, 255, 0.6)',
            fill: 'transparent',
            lineWidth: 1.5
          },
          silent: true
        };
      },
      data: [0]
    },
    {
      name: 'ring5',
      type: 'custom',
      zlevel: 1,
      coordinateSystem: 'none',
      renderItem: function (params, api) {
        return {
          type: 'arc',
          shape: {
            cx: api.getWidth() / 2,
            cy: api.getHeight() / 2,
            r: (Math.min(api.getWidth(), api.getHeight()) / 1.8) * 0.4,
            startAngle: 0,
            endAngle: 360
          },
          style: {
            stroke: 'rgba(14, 95, 255, 0.6)',
            fill: 'transparent',
            lineWidth: 1.5
          },
          silent: true
        };
      },
      data: [0]
    },
    {
      name: 'Access From',
      type: 'pie',
      radius: ['50%', '70%'],
      avoidLabelOverlap: false,
      data: [
        { value: 5, name: '级别1' },
        { value: 10, name: '级别2' },
        { value: 35, name: '级别3' },
        { value: 45, name: '级别4' }
      ],
      itemStyle: {
        borderColor: '#140a69',
        borderWidth: 2
      },
      label: {
        show: false,
        position: 'center'
      },
      emphasis: {
        label: {
          show: true,
          fontSize: 16,
          fontWeight: 'bold',
          color: 'rgba(102, 255, 255, 0.7)',
          formatter(param) {
            return `${param.value}%\n{a|${param.name}}`;
          },
          rich: {
            a: {
              color: '#fff',
              padding: [5, 0],
              fontSize: 12
            }
          }
        }
      },
      labelLine: {
        show: false
      }
    }
  ]
};
function getCirlPoint(x0, y0, r, angle) {
  let x1 = x0 + r * Math.cos((angle * Math.PI) / 180);
  let y1 = y0 + r * Math.sin((angle * Math.PI) / 180);
  return {
    x: x1,
    y: y1
  };
}
function draw(){
    angle = angle+3
    myChart.setOption(option, true)
}
setTimeout(function() {
  setInterval(function() {
    draw()
}, 100);
}, 1000);


  • 10
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

南桥几经秋_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值