Echarts 折线图自动选中并跳转

<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
	<title>Document</title>
	<style type="text/css">
		#myChart{width:1000px;height:500px;}
		#myChart2{width:1000px;height:500px;}
	</style>

</head>
<body>
	<div id="myChart"></div>
	<div id="myChart2"></div>
</body>
</html>
<script src="jquery-2.1.1.min.js"></script>
<script src="https://www.bdsjzx.gov.cn/static_material/source/plugin/data/js/echarts.min.js"></script>


<script type="text/javascript">
                var XIdx_2 = [];
                var data_2 = [55, 86, 46, 45, 77, 96, 89, 88, 23, 38,
                    3, 66, 98, 43, 73, 76, 44, 16, 21, 14,
                    71, 8, 61, 65, 1, 68, 33, 69, 49, 24
                ];
 
                for(var i = 1; i <= data_2.length; i++) {
                    XIdx_2.push(i);
                }
 
                var option_2 = {
                    backgroundColor: 'white',
                    grid: {
//                        top: 20,
//                        left: 20,
//                        right: 20,
//                        bottom: 20,
                        containLabel: true //轴上的数值
                    },
                    xAxis: {
                        type: 'category',
                        data: XIdx_2
                    },
                    yAxis: {
                        type: 'value'
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    series: [{
                        name: '人',
                        type: 'line',
                        data: data_2
                    }]
                };
                var myChart_2 = echarts.init(document.getElementById("myChart2"));
                myChart_2.setOption(option_2);

				var index8 = 0;
				var mTime = setInterval(function() {
					myChart_2.dispatchAction({
						type: 'showTip',
						seriesIndex: 0,
						dataIndex: index8
					});
					index8++;
					if (index8 > option_2.series[0].data.length) {
						index8 = 0;
					}
				}, 1000);


        </script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值