直接上代碼spa
timeId=setInterval(function () { if(count<11){ myChart.dispatchAction({ type: 'downplay', seriesIndex: 0, }); myChart.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: count }); myChart.dispatchAction({ type: 'showTip', seriesIndex:0 , dataIndex: count, }); count++; }else { count=0; } },5000); myChart.on('mouseover',function(par){ clearInterval(timeId); count=par.dataIndex; myChart.dispatchAction({ type: 'downplay', seriesIndex: 0, }); myChart.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: count }); myChart.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: count }); }); myChart.on('mouseout',function(par){ timeId&&clearInterval(timeId); timeId=setInterval(function () { if(count<11){ myChart.dispatchAction({ type: 'downplay', seriesIndex: 0, }); myChart.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: count }); myChart.dispatchAction({ type: 'showTip', seriesIndex:0 , dataIndex: count, }); count++; }else { count=0; } },5000) });