代码片断:
来自:https://blog.csdn.net/qq_36947128/article/details/90899564
function Play(){ chart.dispatchAction({ type:"downplay", seriesIndex:0, }); chart.dispatchAction({ type:"highlight", seriesIndex:0, dataIndex:hourIndex }); chart.dispatchAction({ type:"showTip", seriesIndex:0, dataIndex:hourIndex }); hourIndex++; if(hourIndex > data.length){ hourIndex=0; } } var hourIndex=0; var fhourTime = setInterval(Play, 3000); //鼠标移入停止轮播 chart.on("mousemove", function(e) { clearInterval(fhourTime) }) //鼠标移出恢复轮播 chart.on("mouseout", function() { fhourTime = setInterval(Play, 3000); })