-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
191 lines (177 loc) · 10.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
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<title>Rome Safe Roads</title>
<link rel="stylesheet" href="src/index.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<link type="text/css" href="src/index.css">
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<script src="https://api.mapbox.com/mapbox-gl-js/v2.6.1/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v2.6.1/mapbox-gl.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/@turf/turf@latest/turf.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
</head>
<body style="background-color: #f7f3eb" onload="updatePlotsBasingOnSelectedYear(), createHTMLButtons()" id="body">
<script src="https://unpkg.com/d3@7.8.2/dist/d3.min.js"></script>
<!-- Load d3.js -->
<script src="https://d3js.org/d3.v4.js"></script>
<!-- load plugin for color scales -->
<script src="https://d3js.org/d3-scale-chromatic.v1.min.js"></script>
<!-- Header -->
<div class="container" style="max-width:100vw; background-color:#ebe5da;">
<header class="d-flex flex-wrap justify-content-center py-3 border-bottom custom-border" style="height:50px; border-bottom-color: #d4d0c5 !important; border-width: 2px !important;">
<a class="d-flex align-items-center text-dark text-decoration-none" style="margin-top: 0px; margin-bottom: 0px; margin-right:45%;">
<span class="fs-3" id="title" style="margin-top: -10px; margin-bottom: 10px; font-size: 1.7vw !important;">Rome Safe Roads 2022 </span>
<span class="" id="period" style="margin-top: -8px; margin-bottom: 10px; margin-left:1vw; font-size: 1.2vw;"> (Jan - Aug)</span>
</a>
<p id="sliderValues" style="margin-top: -2px; margin-bottom: 1rem; margin-right: 0.5vw; font-size: 1vw;">Select year:</p>
<div class="slider-container" style="margin-top: -23px; color:#e6e1d5;">
<select id="yearSlider" class="form-select" aria-label="Default select example">
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
<option selected value="2022">2022</option>
</select>
</div>
<button id="reset" type="button" class="button" style="position:absolute; top:15px; right:2.5%; background-image: url('dataset/img/BlackAndWhite/NoneBW.png');"></button>
</header>
</div>
<!-- Create a div where the graph will take place -->
<div class="container" style="max-width:95vw;">
<div class="row">
<div class="col-1" style="align-self:center;">
<svg preserveAspectRatio="xMinYMin meet" viewBox="0 0 150 120">
<rect width="100%" height="100%" x="0" y="0" fill="transparent" />
<foreignObject x="0" y="0" width="100%" height="100%">
<div class="d-flex flex-column justify-content-center align-items-center pop-animation" style="width: 100%; height: 100%; ">
<div style="margin-bottom: -10px;">
<text id="weather">Weather:</text>
</div>
<div class="d-flex justify-content-center align-items-center" style="margin-bottom: 35px;">
<input type="checkbox" id="switchWeather" class="checkbox" style="display: none;">
<label for="switchWeather" class="toggle switch" style="display: inline-block;">
<span class="slider-switch-weather round"></span>
<span class="slider-labels-weather">
<span class="on" id="weatheron" style="padding-right: 33px;">ON</span>
<span class="off" id="weatheroff" style="display:none; padding-left: 33px;">OFF</span>
</span>
</label>
</div>
</div>
</foreignObject>
</svg>
<svg preserveAspectRatio="xMinYMin meet" viewBox="0 0 110 300">
<rect width="100%" height="100%" x="0" y="0" fill="transparent" />
<foreignObject x="0" y="0" width="100%" height="100%">
<div class="d-flex flex-column justify-content-center align-items-center" style="width: 100%;">
<div id="buttons" class="d-flex flex-column" style="align-items: center; justify-content: center;"></div>
</div>
</foreignObject>
</svg>
</div>
<div class="col-6" id="anim">
<div id="verticalBarChart"></div>
<div id="loader"></div>
<!-- Contenitore per la linea verticale -->
<div class="d-flex flex-column justify-content-center position-absolute" style=" top: 10%; right: 5%; height: 170%;">
<!-- Linea verticale -->
<div style="width: 1px; height: 100%; background-color:#d4d0c5;"></div>
</div>
</div>
<div class="col-5" id="animTwo">
<div id="radiobuttons" style="width:100px; transform: translateX(-35px) translateY(25px) scale(0.7);">
<p style=" font-weight: bold;">Accidents:</p>
<input type="radio" id="General" name="fav_language" value="General" checked="checked">
<label for="General">General</label><br>
<input type="radio" id="Fatal" name="fav_language" value="Fatal">
<label for="Fatal">Fatal</label><br>
</div>
<div id="radiobuttonsTwo" style="width:100px; transform: translateX(-35px) translateY(25px) scale(0.7);">
<p style=" font-weight: bold;">Map:</p>
<input type="radio" id="MapOne" name="fav_languag" value="MapOne" checked="checked">
<label for="MapOne">Basic</label><br>
<input type="radio" id="MapTwo" name="fav_languag"value="MapTwo">
<label for="MapTwo">Advanced</label><br>
<p id="nnaturee" style=" font-weight: bold; margin-top: 30px; display: none; width: 160px;"></p>
</div>
<div id="choroplethMap" style="height: 0px; width: 0px;">
</div>
<div id="map"></div>
<div id="loaderC"></div>
</div>
</div>
<div class="container" style="max-width:90vw;">
<header class="d-flex flex-wrap justify-content-center py-1 border-bottom custom-border" style="border-bottom-color: #d4d0c5 !important; border-width: 1px !important; position: relative;">
</header>
</div>
<div class="row">
<div class="col-1" style="align-self:center;">
<svg preserveAspectRatio="xMinYMin meet" viewBox="0 0 150 120">
<rect width="100%" height="100%" x="0" y="0" fill="transparent" />
<foreignObject x="0" y="0" width="100%" height="100%">
<div class="d-flex flex-column justify-content-center align-items-center pop-animation" style="width: 100%; height: 100%; margin-top: -40px;">
<div style="margin-bottom: -10px;">
<text id="zoom">Zoom:</text>
</div>
<div class="d-flex justify-content-center align-items-center">
<input type="checkbox" id="switch" class="checkbox" style="display: none;">
<label for="switch" class="toggle switch" style="display: inline-block;">
<span class="slider-switch round"></span>
<span class="slider-labels">
<span class="on" id="on" style="display:none; padding-right: 33px;">ON</span>
<span class="off" id="off" style="padding-left: 33px;">OFF</span>
</span>
</label>
</div>
</div>
</foreignObject>
</svg>
<svg preserveAspectRatio="xMinYMin meet" viewBox="0 0 150 120">
<rect width="100%" height="100%" x="0" y="0" fill="transparent" />
<foreignObject x="0" y="0" width="100%" height="100%">
<div class="d-flex flex-column justify-content-center align-items-center pop-animation" style="width: 100%; height: 100%; margin-top: -40px;">
<div style="margin-bottom: -10px;">
<text id="brush">Brush:</text>
</div>
<div class="d-flex justify-content-center align-items-center">
<input type="checkbox" id="switchBrush" class="checkbox" style="display: none;">
<label for="switchBrush" class="toggle switch" style="display: inline-block;">
<span class="slider-switch-brush round"></span>
<span class="slider-labels-brush">
<span class="on" id="brushon" style="display:none; padding-right: 33px;">ON</span>
<span class="off" id="brushoff" style="padding-left: 33px;">OFF</span>
</span>
</label>
</div>
</div>
</foreignObject>
</svg>
</div>
<div class="col" id="animThree">
<div><p style="display:none;"></p></div>
<div id="timeSeries"></div>
<div id="dropMenu"></div>
<div id="loaderS"></div>
</div>
<div class="col" id="animFour">
<div id="scatterPlot"></div>
<div id="loaderP"></div>
</div>
</div>
</div>
<div id="popup" style="opacity:0;"></div>
<div id="popupChoropleth" style="opacity:0;"></div>
<div id="popupTimeSeries" style="opacity:0;"></div>
<div id="popupScatterPlot" style="opacity:0;"></div>
<!-- reference to the javascript file that draws the barchart -->
<script src="src/index.js"></script>
<script src="src/plots/verticalBarChart.js"></script>
<script src="src/plots/weatherButtons.js"></script>
<script src="src/plots/choroplethMap.js"></script>
<script src="src/plots/timeSeriesChart.js"></script>
<script src="src/plots/scatterPlot.js"></script>
<script src="https://code.jquery.com/jquery-3.6.4.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
</body>