echarts轮播地图并结合鼠标浮动点击

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

直接上代码

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)
            });

转载于:https://my.oschina.net/u/3407699/blog/1834969

你可能感兴趣的:(echarts轮播地图并结合鼠标浮动点击)