300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > echarts:基于上一篇我来给大家讲讲 如果你设置了自动播放但是鼠标放上去不生效 停留

echarts:基于上一篇我来给大家讲讲 如果你设置了自动播放但是鼠标放上去不生效 停留

时间:2021-02-01 02:45:15

相关推荐

echarts:基于上一篇我来给大家讲讲 如果你设置了自动播放但是鼠标放上去不生效 停留

视频就不给大家演示了 大家看上一篇👆

来 上代码

clearInterval(mTimer);let than = this.chart;var app = {currentIndex: -1,};let dataLen = 0;if (mixChartData.series[0].data.length > 0 && typeof mixChartData.series[0].data != 'undefined') {dataLen = mixChartData.series[0].data.length}var mTimer = setInterval( () => {if(!this.isAutoChangeTooltip){return;}// 取消之前高亮的图形than.dispatchAction({type: 'downplay',seriesIndex: 0,dataIndex: app.currentIndex});app.currentIndex = (app.currentIndex + 1) % dataLen;// 高亮当前图形than.dispatchAction({type: 'highlight',seriesIndex: 0,dataIndex: app.currentIndex,});// 显示 tooltipthan.dispatchAction({type: 'showTip',seriesIndex: 0,dataIndex: app.currentIndex});}, 1500);// 鼠标移入移出事件this.chart.on('mouseover', (params)=> {this.isAutoChangeTooltip = false});this.chart.on('mouseout', (params) =>{this.isAutoChangeTooltip = true});

基本就和上一篇没有大的区别

就是可以看到 我运用到echarts的事件

添加链接描述

大家可以点击这去官网看一下

就是这块就是事件的处理

所以我运用到鼠标移入移出的事件

看以上代码 首先我必须声明一个参数为true

我在走进这个计时器我要判断一下

if(!this.isAutoChangeTooltip){

return;

}

是不是true 好啦

完美 完美完美

echarts:基于上一篇我来给大家讲讲 如果你设置了自动播放但是鼠标放上去不生效 停留时间很短 应该怎么做呢???

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。