-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtongji.html
214 lines (208 loc) · 7.49 KB
/
tongji.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="./css/htmleaf-demo.css" rel="stylesheet">
<link href="./css/nav.css" rel="stylesheet">
<link href="./css/index.css" rel="stylesheet">
<link href="./bootstrap-3.4.1-dist/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="./js/jquery-1.11.0.min.js"></script>
<script src="./js/echarts.min.js"></script>
<script>
$(function () {
$.get("nav.html", function (data) {
$(".nav").html(data);
});
});
function main1() {
var chartDom = document.getElementById('main1');
var myChart = echarts.init(chartDom);
// 获取当前的option
randomList = [
[12032, 12210, 13270, 11034, 13601, 12570, 15678],
[12457, 13235, 18570, 13422, 18333, 14543, 14526],
[12267, 12789, 13246, 13560, 18790, 12401, 16787],
];
var random = $("#input-device option:selected").val();
console.log(random)
var option;
option = {
title: {
text: '本周访客流量变化'
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [
{
data: randomList[random],
type: 'line',
itemStyle: {
normal: {
label: {
show: true, //开启显示
position: 'top', //在上方显示
textStyle: { //数值样式
color: 'black',
fontSize: 16
}
}
}
}
}
]
};
option && myChart.setOption(option);
};
function main2() {
var chartDom = document.getElementById('main2');
var myChart = echarts.init(chartDom);
randomList = [
[109897, 125601, 117024, 118960],
[90401, 135605, 127003, 138047],
[110198, 127609, 97022, 108301]
];
var random = $("#input-device option:selected").val();
var option;
option = {
title: {
text: '本月访客流量变化'
},
xAxis: {
type: 'category',
data: ['week1', 'week2', 'week3', 'week4']
},
yAxis: {
type: 'value'
},
series: [
{
data: randomList[random],
type: 'line',
itemStyle: {
normal: {
label: {
show: true, //开启显示
position: 'top', //在上方显示
textStyle: { //数值样式
color: 'black',
fontSize: 16
}
}
}
}
}
],
};
option && myChart.setOption(option);
};
$(document).ready(function () {
main1();
main2()
});
function main() {
main1();
main2();
}
</script>
<title>流量统计</title>
</head>
<body>
<div id="placehold" style="width: 180px;height: 100%;float: left"></div>
<div class="card">
<div style="width: 100%;height:50%;float: left;margin-top: 10px;margin-bottom:0px;color: black">
<form class="form-inline" style="padding-left: 25px;">
<div class="form-group">
<h5 class="form-control-static">站 点: </h5>
</div>
<div class="form-group">
<select id="input-device" class="form-control">
<option value=0>Site1</option>
<option value=1>Site2</option>
<option value=2>Site3</option>
</select>
</div>
<input id="btn-jiece" type="button" style="margin-left: 10px;outline: none"
class="btn btn-default" onclick="main() " value="监测">
<input id="btn-reset" type="button" style="margin-left: 5px;outline: none" class="btn btn-default"
onclick="location.reload();" value="重置">
</form>
<div>
<div class="form-inline" style="display: inline-block;float: left;margin-left: 20px;float:left">
<!-- 为 ECharts 准备一个定义了宽高的 DOM -->
<div id="main1" style="width: 500px;height:240px;float: left"></div>
<!-- 为 ECharts 准备一个定义了宽高的 DOM -->
<div id="main2" style="width: 500px;height:240px; float: left"></div>
</div>
<div class="form-inline" style="width: 40%;display: inline-block; margin: auto;">
<div class="panel panel-default">
<!-- Default panel contents -->
<div class="panel-heading">站点流量统计排行</div>
<!-- Table -->
<table class="table">
<tr>
<th style="text-align: center">#</th>
<th style="text-align: center">站点区域</th>
<th style="text-align: center">实时访客数</th>
<th style="text-align: center">历史访客数</th>
</tr>
<tr>
<td>1</td>
<td>Site1</td>
<td id="shishi1"></td>
<td>1756715</td>
</tr>
<tr>
<td>2</td>
<td>Site2</td>
<td id="shishi2"></td>
<td>1816915</td>
</tr>
<tr>
<td>3</td>
<td>Site3</td>
<td id="shishi3"></td>
<td>1616813</td>
</tr>
</table>
</div>
<script type="text/javascript">
var randomList = [
["356", "443", "287"],
["448", "367", "556"],
["572", "254", "443"],
["269", "342", "335"],
["374", "272", "258"]
]
var random = Math.ceil(Math.random() * 4)
var shishi = randomList[random]
var place1 = document.getElementById('shishi1');
var place2 = document.getElementById('shishi2');
var place3 = document.getElementById('shishi3');
place1.innerText = shishi[0]
place2.innerText = shishi[1]
place3.innerText = shishi[2]
</script>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default">首页</button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default">上一页</button>
<button type="button" class="btn btn-info active">1</button>
<button type="button" class="btn btn-default">下一页</button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default">尾页</button>
</div>
</div>
</div>
</div>
</div>
<div class="nav"></div>
</body>
</html>