-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
162 lines (143 loc) · 5.99 KB
/
index.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
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>SWD Execution trending</title>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js"></script>
<script type="text/javascript" src="swd_trending_data.js"></script>
</head>
<body>
<table>
<tr>
<td width="533" style="text-align: left; font-family: arial; font-size: 12px"" id="prev_link"><a href="#" onclick="previous_page()">Previous page</a></td>
<td width="533" style="text-align: center; font-family: arial; font-size: 12px"" id="home_link"><a href="#" onclick="home_page()">Home</a></td>
<td width="533" style="text-align:right; font-family: arial; font-size: 12px"" id="next_link"><a href="#" onclick="next_page()">Next page</a></td></tr>
<tr>
</table><table><tr>
<td><div id="chart_div_top1" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top2" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top3" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top4" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top5" style="width: 1600px; height: 450px;"></div></td>
</tr>
<td><div id="chart_div_top6" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top7" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top8" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top9" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top10" style="width: 1600px; height: 450px;"></div></td>
</tr>
<td><div id="chart_div_top11" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top12" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top13" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top14" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top15" style="width: 1600px; height: 450px;"></div></td>
</tr>
<td><div id="chart_div_top16" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top17" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top18" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top19" style="width: 1600px; height: 450px;"></div></td>
</tr><tr>
<td><div id="chart_div_top20" style="width: 1600px; height: 450px;"></div></td>
</tr>
</table>
<table>
<tr>
<td width="533" style="text-align: left; font-family: arial; font-size: 12px"" id="prev_link"><a href="#" onclick="previous_page()">Previous page</a></td>
<td width="533" style="text-align: center; font-family: arial; font-size: 12px"" id="home_link"><a href="#" onclick="home_page()">Home</a></td>
<td width="533" style="text-align:right; font-family: arial; font-size: 12px"" id="next_link"><a href="#" onclick="next_page()">Next page</a></td></tr>
<tr>
</table></body>
<script type="text/javascript">
// Handle the request parameters and set default values if undefined or excessive
function get(name){
if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search))
return decodeURIComponent(name[1]);
}
var page_id = get('page_id');
var chart_count = get('chart_count');
if (typeof page_id === 'undefined') {
page_id = 0;
}
if (typeof chart_count === 'undefined') {
chart_count = 20;
}
if (chart_count > 20) {
chart_count = 20;
}
// In case the trending_data doesn't define object_count assume we have 20 entries only
if (typeof object_count === 'undefined') {
object_count = 20;
}
// Remove Navigation link for first (prev) and last page (next)
if (page_id * 1 - 1 < 0) {
document.getElementById("prev_link").innerHTML = "";
}
if ((page_id * 1 + 1) * chart_count > object_count) {
document.getElementById("next_link").innerHTML = "";
}
// Draw the charts for each defined top_n objects
function drawAllCharts() {
var i = 0
for (; i < chart_count; i++) {
drawChart(page_id * chart_count + (i + 1))
}
// Hide unused divs
i++;
for (; i < 21; i++) {
var elem = document.getElementById("chart_div_top" + i.toString());
elem.parentElement.removeChild(elem);
}
}
// Draw individual charts
function drawChart(chart_id) {
chart_div = chart_id - (page_id * chart_count);
var base = "top_" + chart_id.toString();
var div = 'chart_div_top' + chart_div.toString();
var table = window[base].stats.hourly;
for (var i = 0; i < table.length; i++) {
table [i].splice(1,1);
}
var data_hourly = google.visualization.arrayToDataTable(window[base].stats.hourly);
var options_hourly = {
title: window[base].name,
hAxis: {title: 'Hour'},
colors: ['green', 'red'],
isStacked : true
};
var chart_hourly = new google.visualization.AreaChart(document.getElementById(div));
chart_hourly.draw(data_hourly, options_hourly);
}
// Handle next page navigation clicks
function next_page () {
var next_page = page_id * 1 + 1;
window.location = location.pathname + "?page_id=" + next_page.toString() + "&chart_count=" + chart_count.toString();
}
// Handle previous page navigation clicks
function previous_page() {
var previous_page = page_id * 1 - 1;
window.location = location.pathname + "?page_id=" + previous_page.toString() + "&chart_count=" + chart_count.toString();
}
// Handle home page navigation clicks (use default params)
function home_page() {
window.location = location.pathname;
}
// Call the Google API right at the end
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawAllCharts);
</script>
</html>