echars水状_echars 饼状图 轮循 水平翻转

Echars|饼状图|轮循|水平翻转

直接访问

333

var yDataList =[{

value:335,

name:'直接访问'},

{

value:310,

name:'邮件营销'},

{

value:234,

name:'联盟广告'},

{

value:135,

name:'视频广告'},

{

value:1548,

name:'搜索引擎'}

];var option ={

title: {

text:'某站点用户访问来源',

subtext:'纯属虚构',

x:'center'},

tooltip: {

trigger:'item',

formatter:"{a}
{b} : {c} ({d}%)"},

legend: {

orient:'vertical',

left:'left',

data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎']

},

series: [{

name:'访问来源',

type:'pie',

radius: ['50%', '70%'],

center: ['50%', '60%'],

data: yDataList,

itemStyle: {

emphasis: {

shadowBlur:10,

shadowOffsetX:0,

shadowColor:'rgba(0, 0, 0, 0.5)'}

}

}]

};var index = -1;var timer = null;var myChart = echarts.init(document.getElementById('demo'))

myChart.setOption(option)

myChart.on("mouseover", (e) =>{

loopStop(e.dataIndex)

});this.myChart.on("mouseout", () =>{

loopStart()

});

loopStart()

function loopStart() {

clearInterval(timer)

timer= setInterval(() =>{

myChart.dispatchAction({

type:"downplay",

dataIndex: index

});

index++

if (index >=yDataList.length) {

index= 0}

myChart.dispatchAction({

type:"highlight",

dataIndex: index

});

},2000);

}

function loopStop(i) {

clearInterval(timer)

myChart.dispatchAction({

type:"downplay",

dataIndex: index

});

index=i

myChart.dispatchAction({

type:"highlight",

dataIndex: i

});

}

position: absolute;

left: 271px;

top: 170px;

text-align: center;

animation: rotate 2s linear infinite;

}/*@keyframes circling{

from{

transform:rotate(0deg);

}

to{

transform:rotate(360deg);

}

}*/@keyframes rotate {0%{

opacity:0;

transform: rotate(0deg);

transform: rotateY(0deg);

;

}20%{

opacity:1;

transform: rotateY(360deg);

}100%{

opacity:1;

transform: rotateY(360deg);

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值