-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapa.html
204 lines (179 loc) · 7.31 KB
/
mapa.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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>QoS por comunas de la Región Metropolitana</title>
<script type="text/javascript" src="js/raphael.min.js"></script>
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
</head>
<body>
<h1>QoS por comunas de la Región Metropolitana</h1>
<h2>Datos de ISPs capturados con WiFi</h2>
<hr />
<div id="comunatxt">Selecciona una comuna</div>
<div id="lienzo">
<img id="loadingicon" src="images/loading.gif" />
</div>
<div id="table_data"></div>
<div id="wifi_table"></div>
<script>
var default_attributes = {
fill: '#abcabc',
stroke: '#000000',
'stroke-width': 4,
};
var comunas_data = {
'Padre_Hurtado' :{"name":'Padre Hurtado' , "wifi":[], "mobile":[]},
'Maipú' :{"name":'Maipú' , "wifi":[], "mobile":[]},
'Cerrillos' :{"name":'Cerrillos' , "wifi":[], "mobile":[]},
'Estación_Central' :{"name":'Estación Central' , "wifi":[], "mobile":[]},
'Pudahuel' :{"name":'Pudahuel' , "wifi":[], "mobile":[]},
'Lo_Prado' :{"name":'Lo Prado' , "wifi":[], "mobile":[]},
'Cerro_Navia' :{"name":'Cerro Navia' , "wifi":[], "mobile":[]},
'Santiago' :{"name":'Santiago' , "wifi":[], "mobile":[]},
'Renca' :{"name":'Renca' , "wifi":[], "mobile":[]},
'Quinta_Normal' :{"name":'Quinta Normal' , "wifi":[], "mobile":[]},
'Recoleta' :{"name":'Recoleta' , "wifi":[], "mobile":[]},
'Independencia' :{"name":'Independencia' , "wifi":[], "mobile":[]},
'Quilicura' :{"name":'Quilicura' , "wifi":[], "mobile":[]},
'Conchalí' :{"name":'Conchalí' , "wifi":[], "mobile":[]},
'San_Bernardo' :{"name":'San Bernardo' , "wifi":[], "mobile":[]},
'El_Bosque' :{"name":'El Bosque' , "wifi":[], "mobile":[]},
'La_Cisterna' :{"name":'La Cisterna' , "wifi":[], "mobile":[]},
'Lo_Espejo' :{"name":'Lo Espejo' , "wifi":[], "mobile":[]},
'Pedro_Aguirre_Cerda' :{"name":'Pedro Aguirre Cerda' , "wifi":[], "mobile":[]},
'San_Miguel' :{"name":'San Miguel' , "wifi":[], "mobile":[]},
'San_Ramón' :{"name":'San Ramón' , "wifi":[], "mobile":[]},
'La_Granja' :{"name":'La Granja' , "wifi":[], "mobile":[]},
'San_Joaquín' :{"name":'San Joaquín' , "wifi":[], "mobile":[]},
'La_Pintana' :{"name":'La Pintana' , "wifi":[], "mobile":[]},
'Providencia' :{"name":'Providencia' , "wifi":[], "mobile":[]},
'Ñuñoa' :{"name":'Ñuñoa' , "wifi":[], "mobile":[]},
'La_Reina' :{"name":'La Reina' , "wifi":[], "mobile":[]},
'Macul' :{"name":'Macul' , "wifi":[], "mobile":[]},
'Puente_Alto' :{"name":'Puente Alto' , "wifi":[], "mobile":[]},
'Pirque' :{"name":'Pirque' , "wifi":[], "mobile":[]},
'San_José_de_Maipo' :{"name":'San José de Maipo' , "wifi":[], "mobile":[]},
'La_Florida' :{"name":'La Florida' , "wifi":[], "mobile":[]},
'Peñalolén' :{"name":'Peñalolén' , "wifi":[], "mobile":[]},
'Las_Condes' :{"name":'Las Condes' , "wifi":[], "mobile":[]},
'Vitacura' :{"name":'Vitacura' , "wifi":[], "mobile":[]},
'Lo_Barnechea' :{"name":'Lo Barnechea' , "wifi":[], "mobile":[]},
'Huechuraba' :{"name":'Huechuraba' , "wifi":[], "mobile":[]}
}
var $conumatxt = $('#comunatxt');
var $table_data = $('#table_data');
$.ajax({
url: 'images/Comunas_de_Santiago_(plain).svg',
type: 'GET',
dataType: 'xml',
success: function(xml) {
var rjs = Raphael("lienzo", 400, 400);
rjs.setViewBox(-60, 0, 612, 792, false);
var corr="";
//$(xml).find('svg')
//.setAttribute("viewBox", "0 0 612 792")
$(xml).find('svg > path').each(function() {
var path = $(this).attr('d');
var pid = $(this).attr('id');
var comunas = rjs.path(path);
//rjs.style.viewBox="0 0 612 792"
comunas.attr(default_attributes);
comunas.hover(function() {
this.animate({ fill: '#00bbff' });
var text = "Comuna: ";
if (typeof(comunas_data[pid])!='undefined'){
text+= comunas_data[pid].name
if(comunas_data[pid].wifi.length>0){
var table_data = '<table class="table table-bordered table-striped">';
table_data += '<tr>';
table_data += '<th>Comuna</th>'
table_data += '<th>ISP</th>'
table_data += '<th>Count</th>'
table_data += '<th>AVG RTT</th>'
table_data += '<th>AVG JITTER</th>'
table_data += '</tr>';
table_data += '<tr>';
for (val in comunas_data[pid].wifi){
table_data += '<tr>';
value = comunas_data[pid].wifi[val]
for (col in value){
table_data += '<td>'+value[col]+'</td>';
}
table_data += '</tr>';
}
table_data += '</table>';
$table_data.html(table_data);
//text+= table_data
}
}
else
text+="Sin nombre";
//text+="("+$(this).attr('id')+")";
$conumatxt.html(text);
}, function() {
this.animate({ fill: default_attributes.fill });
$conumatxt.html("Selecciona una comuna");
$table_data.html("");
}). click(function() {
alert("Click sobre una comuna. ID = "+$(this).attr('id'));
});
});
$('#loadingicon').hide();
}
});
$.ajax({
url:"res/ResultsQOSWiFi.csv",
dataType:"text",
encType:'utf-8',
success:function(data)
{
wifiQOS = []
console.log(data);
wifi_data = data.split('\r\n');
console.log(wifi_data.length)
if(wifi_data.length<=1){
wifi_data = data.split('\n');
console.log(wifi_data.length)
}
// var table_data = '<table class="table table-bordered table-striped">';
// table_data += '<tr>';
var headers = wifi_data[0].split(", ")
try{
console.log(headers[7])
}catch(error){
console.log(error, headers)
}
// for(col in headers){
// console.log(headers[col]);
// table_data += '<th>'+headers[col]+'</th>';
// }
// table_data += '</tr>';
for(var count = 1; count<wifi_data.length; count++){
//cols = wifi_data[count]
// table_data += '<tr>';
console.log(wifi_data[count]);
row= wifi_data[count].split(", ")
wifiQOSrow ={}
for(col in row){
wifiQOSrow[headers[col]]=row[col]
// table_data += '<td>'+row[col]+'</td>';
}
//console.log(row[0])
try{
comunas_data[row[0].replaceAll(' ', '_')]["wifi"].push(wifiQOSrow);
}catch(error){
console.log(row[0]);
}
wifiQOS.push(wifiQOSrow);
// table_data += '</tr>';
}
// table_data += '</table>';
// $('#wifi_table').html(table_data);
console.log(wifiQOS)
console.log(comunas_data)
}
});
</script>
</script>
</body>
</html>