当前位置:网站首页>Add a shuffling effect to every pie
Add a shuffling effect to every pie
2022-07-31 09:35:00 【an ordered source】
Echart pie chart rotation effect
The key code is as follows. The length of the pie chart data and the pie chart echart object can be passed in to complete the rotation of the pie chart. The code is as follows:
/**** @param pieDataLength pie data length* @param ec Pie chart echart object* @param time rotation time*/export function pipeAnimation(pieDataLength: number, ec: any,time:number) {let timer = null;if (pieDataLength < 2) {setTimeout(() => {ec.dispatchAction({type: 'highlight',seriesIndex: 0,dataIndex: 0})})return;}let curIndex = 0;if (timer) {clearInterval(timer)}timer = setInterval(() => {let dataLen = pieDataLength;ec.dispatchAction({ type: 'downplay', seriesIndex: 0, dataIndex: curIndex });curIndex = (curIndex + 1) % dataLenec.dispatchAction({type: 'highlight', seriesIndex: 0, dataIndex: curIndex});}, time);ec.on('mouseover', function (param) {clearInterval(timer)ec.dispatchAction({type: 'downplay',seriesIndex: 0,dataIndex: curIndex})ec.dispatchAction({type: 'highlight',seriesIndex: 0,dataIndex: param.dataIndex})curIndex = param.dataIndex;})ec.on('mouseout', function (param) {curIndex = param.dataIndex;if (timer) {clearInterval(timer)}timer = setInterval(() => {let dataLen = pieDataLength;ec.dispatchAction({ type: 'downplay', seriesIndex: 0, dataIndex: curIndex });curIndex = (curIndex + 1) % dataLenec.dispatchAction({type: 'highlight', seriesIndex: 0, dataIndex: curIndex});}, time);})}Highlight the pie chart, hide the key code settings, and control the time by monitoring the mouse movement in and out.Export it as a public method, call it directly when using it, and pass in the data length and the ecahrt graphic object.Simple operation
边栏推荐
猜你喜欢
随机推荐
Gradle series - Groovy overview, basic use (based on Groovy document 4.0.4) day2-1
Chapter VII
centos7安装mysql5.7
第二十三课,抗锯齿(Anti Aliasing)
loadrunner-controller-view script与load generator
实现线程池
浏览器使用占比js雷达图
混合型界面:对话式UI的未来
数据中台建设(六):数据体系建设
Canvas particles change various shapes js special effects
canvas粒子变幻各种形状js特效
OpenGL es 导读篇
解决rpc error: code = Unimplemented desc = method CheckLicense not implemented
js滚动条滚动到指定元素
What is the encoding that starts with ?
MySQL 高级(进阶) SQL 语句 (一)
Feign介绍
js部门预算和支出雷达图
各位大佬,sqlserver 支持表名正则匹配吗
ReentrantLock









