echarts饼图 外圈转动动画 pie

在这里插入图片描述

就是这个东西,会围着饼图转动

准备:两个div,一个装饼图,一个装那个转圈的。。。这里就只写转圈的了,饼图就不写了

js代码:

showpieLinex();
function showpieLinex(){
        var myChartLine = echarts.init(document.getElementById('toprightviewLines'));

        var tips = 0;
        var m=0;
        var mm=1;

        function loading() {
            return [
                {
                    value: tips,
                    itemStyle: {
                        normal: {
                            color: 'rgba(0,0,0,0)',
                        }
                    }
                },
                {
                    value: m,
                    itemStyle: {
                        normal: {
                            borderWidth: 5,
                            borderColor: {
                                type: 'linear',
                                x: 0,
                                y: 0,
                                x2: 0,
                                y2: 4,
                                colorStops: [{
                                    offset: 0,
                                    color: 'rgba(255,255,255,0.7)' // 0% 处的颜色
                                },{
                                    offset: 0.3,
                                    color: 'rgba(255,255,255,1)' // 0% 处的颜色
                                },{
                                    offset: 0.6,
                                    color: 'rgba(255,255,255,1)' // 0% 处的颜色
                                },{
                                    offset: 0.8,
                                    color: 'rgba(255,255,255,1)' // 0% 处的颜色
                                },{
                                    offset: 1,
                                    color: 'rgba(255,255,255,1)' // 100% 处的颜色
                                }],
                                globalCoord: false,
                            },
                            color: 'rgba(255,255,255,0)',
                            shadowBlur: 30,
                            shadowColor: 'rgba(255,255,255,1)'
                        }
                    }
                }, {
                    value: 100 - tips,
                    itemStyle: {
                        normal: {
                            color: 'rgba(0,0,0,0)',
                        }
                    }
                }];
        }

        setInterval(function() {
            if (tips == 100) {
                tips = 0;
                m=0;
            }else if(tips<=10){
                ++tips;
                ++m
            }else if(tips>=90){
                ++tips;
                --m
            }else{
                ++tips;
            }

            myChartLine.setOption({
                animation:false,
                animationThreshold:100,
                animationDurationUpdate: function (idx) {
                    // 越往后的数据延迟越大
                    return idx * 1000;
                },
                series: [{
                    name: 'loading',
                    type: 'pie',
                    radius: ['66%', '68%'],
                    center: ['50%', '50%'],
                    hoverAnimation: false,
                    label: {
                        normal: {
                            show: false,
                        }
                    },
                    data: loading()
                }]
            })
        }, 50);
    }
  • 5
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值