Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5928fb6

Browse files
committed
实时开奖结果 折线图 待完善
1 parent 8578b38 commit 5928fb6

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

彩票爬虫/s.html

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,26 @@
66
</head>
77
<body>
88
<script src="echarts.min.js"></script>
9+
<script src="jquery.min.js"></script>
910
<div id="main" style="width: 100%;height:500px;"></div>
1011

1112
<script>
1213
var myChart = echarts.init(document.getElementById('main'));
1314

14-
var date = [];
15+
var time_date = [];
1516
var randomData = [];
1617

1718
for (var i = 0; i < 30; i++) {
18-
date.push('第' + (i + 1) + '天');
19+
d = new Date();
20+
time_date.push(d.getMinutes());
1921
randomData.push(Math.floor(Math.random() * 10));
2022
}
2123

2224
// 指定图表的配置项和数据
2325
var option = {
2426
xAxis: {
2527
type: 'category',
26-
data: date
28+
data: time_date
2729
},
2830
yAxis: {
2931
type: 'value'
@@ -37,22 +39,43 @@
3739
// 使用刚指定的配置项和数据显示图表。
3840
myChart.setOption(option);
3941

40-
var len = date.length;
42+
var len = time_date.length;
4143

4244
setInterval(function () {
45+
$.ajax({
46+
type: "GET",
47+
url: "https://pk10tv.com/pks/getPksHistoryList.do?date=2020-3-18&lotCode=xyft",
48+
dataType: "json",
49+
success: function (data) {
50+
new_data = data['result']['data'];
51+
// console.log(new_data);
52+
53+
time_date.push(new_data[new_data.length - 1]['preDrawCode']);
54+
console.log(new_data[new_data.length - 1]['preDrawCode']);
55+
// for (var i = 0; i <new_data.length ; i++) {
56+
// time_date.push(new_data[i]);
57+
// console.log(new_data[i]['preDrawCode'])
58+
// }
59+
60+
},
61+
error: function (error) {
62+
// time_date.push(1);
63+
console.log(error)
64+
}
65+
});
4366
randomData.push(Math.floor(Math.random() * 10));
4467
randomData.shift();
45-
date.push(len++);
46-
date.shift();
68+
time_date.push(len++);
69+
time_date.shift();
4770
myChart.setOption({
4871
xAxis: {
49-
data: date
72+
data: time_date
5073
},
5174
series: [{
5275
data: randomData
5376
}]
5477
});
55-
}, 2000)
78+
}, 5000)
5679
</script>
5780

5881

0 commit comments

Comments
 (0)