-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
276 lines (247 loc) · 13.7 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
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
<html lang="pt-BR">
<head>
<link rel="stylesheet" href="style.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ANAC 2015-2020</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/locale/pt-br.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
</head>
<body>
<div class="page">
<div class="topnav" id="topnav">
<a href="index.html" class="selected">Geral</a>
<a href="dates.html">Datas</a>
<a href="airports.html">Aeroportos</a>
<a href="companies.html">Empresas</a>
<a href="about.html">Sobre</a>
<div class="space"></div>
<a class="collapse" onclick="collapseTopNav()">...</a>
</div>
<div class="content">
<div class = "box">
<p>Entre 31 de Dezembro de 2014 e 3 de Agosto de 2020 um total <span class="counter" id="flightCounter1">0</span> voos foram registrados no Brasil.</p>
</div>
<div class="group">
<div class = "box">
<p>Entre os <span id="flightCounter2">0</span> voos que aconteceram no nosso pais <span class="counter" id="delayCounter">0</span> sofreram atrasos. Um total de <span class="counter" id="delayPercentage">0</span></p>
</div>
<div class = "box">
<p>Imprevistos acontecem, e na aviação isso não é diferente. <span class="counter" id="cancelledCounter">0</span> voos tiveram que ser cancelados durante esse período. Um total de: <span class="counter" id="cancelledPercentage">0</span></p>
</div>
<div class = "box">
<p>A rota que apresentou mais atrasos foi <span class="counter" id="mostDelayedRoute"></span> O aeroporto com mais atrasos foi <span class="counter" id="mostDelayedAirport"></span> A empresa com mais atrasos foi <span class="counter" id="mostDelayedCompany"></span></p>
</div>
</div>
<div class = "box">
<p>A empresa que fez mais voos em território nacional foi a <span style="font-weight: bold" id="mostUsedCompany"></span> com um total de <span style="font-weight: bold" id="mostUsedCompanyFlightCounter">0</span> voos!</p>
<div style="height: 300px">
<canvas id="companyPie"></canvas>
</div>
</div>
<div class="group">
<div class = "box">
<p>O aeroporto mais movimentado do brasil durante esse período foi <span class="counter" id="mostUsedAirport"></span> com um total de <span style="font-weight: bold" id="mostUsedAirportDepartureCounter">0</span> voos partindo e <span style="font-weight: bold" id="mostUsedAirportArrivalCounter">0</span> voos chegando.</p>
<div style="height: 300px">
<canvas id="airportPie"></canvas>
</div>
</div>
<div class = "box">
<p>A rota mais movimentada foi <span class="counter" id="mostUsedRoute"></span> com um total de <span style="font-weight: bold" id="mostUsedRouteFlightCounter">0</span> voos realizados.</p>
<div style="height: 300px">
<canvas id="routePie"></canvas>
</div>
</div>
</div>
<div class="box">
<p>Gráfico de Voos por Dia</p>
<canvas id="flightGraph"></canvas>
</div>
</div>
<div class="space"></div>
<footer>
<div>
<p>Feito por: Carolaine, Elian Luz, Euma Santos e Luca Argolo<br/>Dúvidas? Mande um email para <a style="color:cornflowerblue" href="mailto:[email protected]">[email protected]</a></p>
</div>
<div class="space"></div>
<p>Trabalho de MATA62 (Engenharia de Software)<br/>2020.3 - UFBA</p>
<p> </p>
<p><a href="https://github.com/lucaargolo/historico-de-voos">
<svg width="40px" height="38px" role="img" viewBox="0 0 24 24">
<path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" fill="#FFFFFF"/>
</svg>
</a></p>
</footer>
</div>
</body>
<script src="common.js"></script>
<script type="module">
// noinspection JSFileReferences
import { CountUp } from "https://cdn.jsdelivr.net/npm/[email protected]/dist/countUp.min.js"
fetch("data/generated/voosPorEmpresa.json").then(res => res.json()).then(function(json) {
let totalFlights = 0
let mostUsedCompany = null
let mostUsedCompanyFlightCount = 0
let companyFlights = []
for(let d in json) {
if(!json.hasOwnProperty(d)) continue;
totalFlights += json[d]
companyFlights.push(json[d])
let company = d
let companyFlightCount = json[d]
if(companyFlightCount > mostUsedCompanyFlightCount) {
mostUsedCompany = company
mostUsedCompanyFlightCount = companyFlightCount
}
}
companyFlights.sort((a, b) => parseInt(b) - parseInt(a))
let otherFlights = companyFlights.splice(9, companyFlights.length-9)
let otherSum = 0
for(let o in otherFlights) {
otherSum += otherFlights[o]
}
let companyArray = []
let companyColors = []
for(let f in companyFlights) {
if(!companyFlights.hasOwnProperty(f)) continue;
companyColors.push(getRandomColor())
let c = Object.keys(json).find(key => json[key] === companyFlights[f]);
companyArray.push(c)
}
companyColors.push("#444444")
companyArray.push("Outros")
companyFlights.push(otherSum)
createPie("companyPie", companyFlights, companyColors, companyArray)
document.getElementById("mostUsedCompany").innerText = mostUsedCompany
let mostUsedCompanyFlightCounter = new CountUp('mostUsedCompanyFlightCounter', mostUsedCompanyFlightCount);
mostUsedCompanyFlightCounter.start();
fetch("data/generated/voosAtrasadosPorEmpresa.json").then(res => res.json()).then(function(json) {
let mostDelayedCompany = "", mostDelayedCompanyQnt = 0;
let voosAtrasados = 0
for(let d in json) {
if(!json.hasOwnProperty(d)) continue;
voosAtrasados += json[d]
if(json[d] > mostDelayedCompanyQnt) {
mostDelayedCompanyQnt = json[d]
mostDelayedCompany = d
}
}
let delayCounter = new CountUp("delayCounter", voosAtrasados)
delayCounter.start();
document.getElementById("mostDelayedCompany").innerText = mostDelayedCompany
document.getElementById("delayPercentage").innerText = ((voosAtrasados/totalFlights)*100).toFixed(2) + "%"
})
fetch("data/generated/voosCanceladosPorEmpresa.json").then(res => res.json()).then(function(json) {
let voosCancelados = 0
for(let d in json) {
if(json.hasOwnProperty(d))
voosCancelados += json[d]
}
let cancelledCounter = new CountUp("cancelledCounter", voosCancelados)
cancelledCounter.start();
document.getElementById("cancelledPercentage").innerText = ((voosCancelados/totalFlights)*100).toFixed(2) + "%"
})
})
fetch("data/generated/voosAtrasadosPorRota.json").then(res => res.json()).then(function(json) {
document.getElementById("mostDelayedRoute").innerText = getMostCommon(json)[0]
})
fetch("data/generated/voosAtrasadosPorOrigem.json").then(res => res.json()).then(function(json) {
document.getElementById("mostDelayedAirport").innerText = getMostCommon(json)[0]
})
fetch("data/generated/voosPorRota.json").then(res => res.json()).then(function(json) {
let routeFlights = Object.values(json)
routeFlights.sort((a, b) => parseInt(b.toString()) - parseInt(a.toString()))
let otherFlights = routeFlights.splice(9, routeFlights.length-9)
let otherSum = 0
for(let o in otherFlights) {
if(!otherFlights.hasOwnProperty(o)) continue;
otherSum += otherFlights[o]
}
let routeArray = []
let routeColors = []
for(let f in routeFlights) {
routeColors.push(getRandomColor())
let c = Object.keys(json).find(key => json[key] === routeFlights[f]);
routeArray.push(c)
}
routeColors.push("#444444")
routeArray.push("Outros")
routeFlights.push(otherSum)
createPie("routePie", routeFlights, routeColors, routeArray)
let mostCommon = getMostCommon(json);
document.getElementById("mostUsedRoute").innerText = mostCommon[0]
new CountUp('mostUsedRouteFlightCounter', mostCommon[1]).start();
})
fetch("data/generated/voosPorOrigem.json").then(res => res.json()).then(function(departureJson) {
let json = {}
for(let v in departureJson) {
if(!departureJson.hasOwnProperty(v)) continue;
json[v] = departureJson[v]
}
fetch("data/generated/voosPorDestino.json").then(res => res.json()).then(function(arrivalJson) {
for(let v in arrivalJson) {
if(!arrivalJson.hasOwnProperty(v)) continue;
if(isNaN(json[v])) {
json[v] = 0;
}
json[v] += arrivalJson[v]
}
let airportFlights = Object.values(json)
airportFlights.sort((a, b) => parseInt(b.toString()) - parseInt(a.toString()))
let otherFlights = airportFlights.splice(9, airportFlights.length-9)
let otherSum = 0
for(let o in otherFlights) {
otherSum += otherFlights[o]
}
let airportArray = []
let airportColors = []
for(let f in airportFlights) {
airportColors.push(getRandomColor())
let c = Object.keys(json).find(key => json[key] === airportFlights[f]);
airportArray.push(c)
}
airportColors.push("#444444")
airportArray.push("Outros")
airportFlights.push(otherSum)
createPie("airportPie", airportFlights, airportColors, airportArray)
let airport = getMostCommon(json)[0]
document.getElementById("mostUsedAirport").innerText = airport
new CountUp('mostUsedAirportDepartureCounter', departureJson[airport]).start();
new CountUp('mostUsedAirportArrivalCounter', arrivalJson[airport]).start();
})
})
fetch("data/generated/voosPorDia.json").then(res => res.json()).then(function(json) {
let xs = []
let day_ys = []
let mean_ys = []
let sum_array = []
let sum = 0
for(let d in json) {
if(!json.hasOwnProperty(d)) continue;
sum += json[d]
let num = parseInt(d)
if(num > 1417392000) { //Check if the date is after 01-12-2014
xs.push(num)
day_ys.push(json[num])
sum_array.unshift(json[num])
if(sum_array.length > 7) {
sum_array.pop()
}
let sum = 0
for(let s in sum_array) {
if(!sum_array.hasOwnProperty(s)) continue;
sum += sum_array[s]
}
mean_ys.push(Math.floor(sum/sum_array.length))
}
}
let flightCounter1 = new CountUp('flightCounter1', sum);
flightCounter1.start();
let flightCounter2 = new CountUp('flightCounter2', sum);
flightCounter2.start();
createFlightGraph("flightGraph", xs, mean_ys, day_ys)
})
</script>
</html>