代碼片斷:
來自: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); })