//轮播效果 var hourIndex = 0; var fhourTime = null; fhourTime = setInterval(function() { myChart.dispatchAction({ type: "downplay", seriesIndex: 0, }); myChart.dispatchAction({ type: "highlight", seriesIndex: 0, dataIndex: hourIndex }); myChart.dispatchAction({ type: "showTip", seriesIndex: 0, dataIndex: hourIndex }); hourIndex++; if (hourIndex > data.length) { hourIndex = 0; } }, 2000); //鼠标移入停止轮播 myChart.on("mousemove", function(e) { clearInterval(fhourTime) myChart.dispatchAction({ type: "downplay", seriesIndex: 0, }); myChart.dispatchAction({ type: "highlight", seriesIndex: 0, dataIndex: e.dataIndex }); myChart.dispatchAction({ type: "showTip", seriesIndex: 0, dataIndex: e.dataIndex }); }) //鼠标移出恢复轮播 myChart.on("mouseout", function() { fhourTime = setInterval(function() { myChart.dispatchAction({ type: "downplay", seriesIndex: 0, }); myChart.dispatchAction({ type: "highlight", seriesIndex: 0, dataIndex: hourIndex }); myChart.dispatchAction({ type: "showTip", seriesIndex: 0, dataIndex: hourIndex }); hourIndex++; if (hourIndex > data.length) { hourIndex = 0; } }, 2000); })