-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtime_profiles.html
390 lines (322 loc) · 9.88 KB
/
time_profiles.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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MosquitoAlertBCN</title>
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="manifest" href="site.webmanifest">
<link rel="mask-icon" href="safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<meta name="description" content="Bringing together citizen science, artificial intelligence, the internet-of-things and traditional entomological trapping methods to create a novel and sophisticated tool for mosquito surveillance and public health decision-making.">
<meta property="og:title" content="MosquitoAlertBCN" />
<meta property="og:url" content="https://mosquito-alert.github.io/MosquitoAlertBCN" />
<meta property="og:description" content="Bringing together citizen science, artificial intelligence, the internet-of-things and traditional entomological trapping methods to create a novel and sophisticated tool for mosquito surveillance and public health decision-making.">
<meta property="og:image" content="time_profile_district_ytd.png">
<meta name="twitter:title" content="MosquitoAlertBCN">
<meta name="twitter:description" content="Bringing together citizen science, artificial intelligence, the internet-of-things and traditional entomological trapping methods to create a novel and sophisticated tool for mosquito surveillance and public health decision-making.">
<meta name="twitter:image" content="time_profile_district_ytd.png">
<meta name="twitter:card" content="summary_large_image">
<!-- including ECharts file -->
<script src="js/echarts.min.js"></script>
<!--bootstrap-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<script src="js/jquery-1.12.4.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="index.html">#MosquitoAlertBCN</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" aria-current="page" href="index.html">Risk Map</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="time_profiles.html">Time Profiles</a>
</li>
<li class="nav-item">
<a class="nav-link" href="daily.html">Daily Report</a>
</li>
<li class="nav-item">
<a class="nav-link" href="about.html">About</a>
</li>
</ul>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<!-- prepare a DOM container with width and height -->
<div id="main" style="width: 100%;height:400px;"></div>
<hr />
<script type="text/javascript">
Date.prototype.addDays = function(days) {
var date = new Date(this.valueOf());
date.setDate(date.getDate() + days);
return date;
}
var myChart = echarts.init(document.getElementById('main'));
$.get('https://raw.githubusercontent.com/Mosquito-Alert/bcn/main/data/bcn_time_profile_data.json').done(function (data) {
this_json = JSON.parse(data);
var these_dates = this_json.map(function(item){return item['date']});
var forecast_start = these_dates[these_dates.length - 7];
var forecast_end = these_dates[these_dates.length - 1];
myChart.setOption({
title: {
left: 'center',
text: 'Barcelona Citywide VRI',
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
toolbox: {
show: true,
feature: {
magicType: {type: ['line', 'bar']},
saveAsImage: {}
}
},
dataZoom: [
{
show: true,
realtime: true
},
{
type: 'inside',
realtime: true
}
],
xAxis: {
type: 'category',
data: these_dates
},
yAxis: {
type: 'value'
},
series: [{
data: this_json.map(function(item){return item['value']}),
type: 'line',
showSymbol: false,
smooth: true,
markArea: {
itemStyle: {
color: 'rgba(255, 173, 177, 0.4)'
},
data: [ [{
name: 'Forecast',
xAxis: forecast_start
}, {
xAxis: forecast_end
}] ]
}
}]
});
});
</script>
</div>
<div class="row">
<!-- prepare a DOM container with width and height -->
<div id="district_chart" style="width: 100%;height:400px;"></div>
<script type="text/javascript">
var district_chart = echarts.init(document.getElementById('district_chart'));
$.get('https://raw.githubusercontent.com/Mosquito-Alert/bcn/main/data/bcn_district_means.json').done(function (data) {
this_json = JSON.parse(data);
var these_dates = [];
var district_names = ["Ciutat Vella", "Eixample", "Sants-Montjuïc", "Les Corts", "Sarrià-Sant Gervasi", "Gràcia", "Horta-Guinardó", "Nou Barris", "Sant Andreu", "Sant Martí"];
var D01 = [];
var D02 = [];
var D03 = [];
var D04 = [];
var D05 = [];
var D06 = [];
var D07 = [];
var D08 = [];
var D09 = [];
var D10 = [];
this_json.forEach(function(item){
if (item['DISTRICTE']=='01')
{ these_dates.push(item['date']);
D01.push(item['value']);
};
if (item['DISTRICTE']=='02')
{ D02.push(item['value']);
};
if (item['DISTRICTE']=='03')
{ D03.push(item['value']);
};
if (item['DISTRICTE']=='04')
{ D04.push(item['value']);
};
if (item['DISTRICTE']=='05') {
D05.push(item['value']);
};
if (item['DISTRICTE']=='06')
{ D06.push(item['value']);
};
if (item['DISTRICTE']=='07')
{ D07.push(item['value']);
};
if (item['DISTRICTE']=='08')
{ D08.push(item['value']);
};
if (item['DISTRICTE']=='09')
{ D09.push(item['value']);
};
if (item['DISTRICTE']=='10')
{ D10.push(item['value']);
};
});
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
var forecast_start = these_dates[these_dates.length - 7];
var forecast_end = these_dates[these_dates.length - 1];
district_chart.setOption({
title: {
left: 'center',
text: 'Barcelona District VRI',
},
legend: {
data: district_names,
orient: 'vertical',
x: 'right',
y: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
toolbox: {
show: true,
feature: {
magicType: {type: ['line', 'bar']},
saveAsImage: {}
}
},
dataZoom: [
{
show: true,
realtime: true
},
{
type: 'inside',
realtime: true
}
],
xAxis: {
type: 'category',
data: these_dates,
},
yAxis: {
type: 'value'
},
series: [{
name: district_names[0],
data: D01,
emphasis: {
focus: 'series'
},
type: 'line',
showSymbol: false,
smooth: true
},
{
name: district_names[1],
data: D02,
emphasis: {
focus: 'series'
},
type: 'line',
showSymbol: false,
smooth: true
},
{
name: district_names[2],
data: D03,
type: 'line',
showSymbol: false,
smooth: true
},
{
name: district_names[3],
data: D04,
type: 'line',
showSymbol: false,
smooth: true
},
{
name: district_names[4],
data: D05,
type: 'line',
showSymbol: false,
smooth: true
},
{
name: district_names[5],
data: D06,
type: 'line',
showSymbol: false,
smooth: true
},
{
name: district_names[6],
data: D07,
type: 'line',
showSymbol: false,
smooth: true
},
{
name: district_names[7],
data: D08,
type: 'line',
showSymbol: false,
smooth: true
},
{
name: district_names[8],
data: D09,
type: 'line',
showSymbol: false,
smooth: true
},
{
name: district_names[9],
data: D10,
type: 'line',
showSymbol: false,
smooth: true,
markArea: {
itemStyle: {
color: 'rgba(255, 173, 177, 0.4)'
},
data: [ [{
name: 'Forecast',
xAxis: forecast_start
}, {
xAxis: forecast_end
}] ]
}
},
]
});
});
</script>
</div>
</div>
<!--bootstrap-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
</body>
</html>