const list=[ {value: 1048, name: '搜索引擎'}, {value: 735, name: '直接访问'}, {value: 580, name: '邮件营销'}, {value: 484, name: '联盟广告'}, {value: 300, name: '视频广告'} ] const values=list.map(o=>o.value) option = { title: { text: '某站点用户访问来源', subtext: '纯属虚构', left: 'center' }, selectedOffset:100, clockwise:true, tooltip: { trigger: 'item' }, legend: { orient: 'vertical', left: 'left', }, series: [ { name: '访问来源', type: 'pie', // roseType:true, startAngle:152, radius: ['25%', '40%'], data: list, itemStyle:{ // shadowOffsetX: 10, borderWidth:20, borderColor:"pink", decal:{ symbolSize:0.2 } }, emphasis: { itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' } } } ] }; const sum=list=>list.reduce((a,b)=>a+b,0) var idx =0 var angle=0 setInterval(()=>{ idx++ if(idx>=list.length){ idx=0 } angle=(360*(sum(values.slice(0,idx))+values[idx]/2)/sum(values)+90)%360 console.log(currentAngle,angle) myChart.setOption({ series:[{ startAngle:angle, selectedOffset:0, selectedMode:true, // datasetIndex:idx, select:{ focus: 'series', label:{ show:true, }, itemStyle: { shadowBlur: 10, shadowColor: 'rgba(0, 0, 0, 0.5)' } } }] }); myChart.dispatchAction({ type: 'select', dataIndex:idx, }); },5000) myChart.on('click',(args)=>{ console.log(args,angle) const index=args.dataIndex angle=(360*(sum(values.slice(0,index))+values[index]/2)/sum(values)+90)%360 //点击后自动旋转的时候就在指定的扇面后旋转 idx = index myChart.setOption({ series:[{ startAngle:angle }] }) })