当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
centos7安装mysql5.7
Feign介绍
各位大佬,sqlserver 支持表名正则匹配吗
来n遍剑指--05. 替换空格
OpenGL es 初识
混合型界面:对话式UI的未来
MySQL (2)
51单片机-----外部中断
文件管理:目录管理
(C语言基础)原样输入输出
Kotlin—基本语法 (五)
踩水坑2 数据超出long long
spark filter
Redis Sentinel原理
第七章
Rich text editor Tinymce
The future of the hybrid interface: conversational UI
A Spark SQL online problem troubleshooting and positioning
如何将虚拟机上的文件复制到主机上
第二十三课,抗锯齿(Anti Aliasing)