-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
119 lines (113 loc) · 6.06 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
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mapa de Condenados</title>
<link rel="stylesheet" href="css/style.css"/>
<link rel="icon" href="img/favicon.ico" type="image/x-icon"/>
</head>
<body>
<div class="div1">
<div class="selectors">
<div>
<h2>Años</h2>
<div class="years-container">
<div>
<label class="selector-box first"><input type="checkbox" class="year-checkbox" name="year" value="2022" checked>2022</label>
<label class="selector-box"><input type="checkbox" class="year-checkbox" name="year" value="2021" checked>2021</label>
<label class="selector-box"><input type="checkbox" class="year-checkbox" name="year" value="2020" checked>2020</label>
<label class="selector-box"><input type="checkbox" class="year-checkbox" name="year" value="2019" checked>2019</label>
<label class="selector-box last"><input type="checkbox" class="year-checkbox" name="year" value="2018" checked>2018</label>
</div>
<div>
<label class="selector-box first"><input type="checkbox" class="year-checkbox" name="year" value="2017" checked>2017</label>
<label class="selector-box"><input type="checkbox" class="year-checkbox" name="year" value="2016" checked>2016</label>
<label class="selector-box"><input type="checkbox" class="year-checkbox" name="year" value="2015" checked>2015</label>
<label class="selector-box"><input type="checkbox" class="year-checkbox" name="year" value="2014" checked>2014</label>
<label class="selector-box last"><input type="checkbox" class="year-checkbox" name="year" value="2013" checked>2013</label>
</div>
</div>
</div>
<div class="sex-nationality">
<div>
<h2>Sexo</h2>
<div class="selectors-container">
<label class="selector-box first"><input type="checkbox" class="sex-checkbox" value="Hombres" checked>Hombres</label>
<label class="selector-box last"><input type="checkbox" class="sex-checkbox" value="Mujeres" checked>Mujeres</label>
</div>
</div>
<div>
<h2>Nacionalidad</h2>
<div class="selectors-container">
<label class="selector-box first"><input type="checkbox" class="nationality-checkbox" value="Española" checked>Española</label>
<label class="selector-box last"><input type="checkbox" class="nationality-checkbox" value="Extranjera" checked>Extranjera</label>
</div>
</div>
</div>
</div>
<div id="percentage-container">
<h2>Brocolímetro🥦👳🏾</h2>
<p id="percentage">0%</p>
</div>
</div>
<div class="div2">
<div class="map-3d" id="map"></div>
</div>
<div class="div3" id="bar-chart-container">
<svg id="bar-chart"></svg>
</div>
<div class="div4" id="chart-container">
<svg id="chart"></svg>
</div>
<script src="https://d3js.org/d3.v6.min.js"></script>
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script src="javascript/script.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Inicializar el estado de las cajas de años
const yearCheckboxes = document.querySelectorAll('.year-checkbox');
yearCheckboxes.forEach(checkbox => {
checkbox.parentElement.style.backgroundColor = checkbox.checked ? 'rgba(255, 255, 255, 0.2)' : 'rgba(255, 255, 255, 0.0)';
});
// Manejar la selección individual de años
yearCheckboxes.forEach(checkbox => {
checkbox.addEventListener('change', function() {
if (!this.checked && Array.from(yearCheckboxes).filter(cb => cb.checked).length === 0) {
this.checked = true; // No permitir deseleccionar la última casilla activa
}
this.parentElement.style.backgroundColor = this.checked ? 'rgba(255, 255, 255, 0.2)' : 'rgba(255, 255, 255, 0.0)';
});
});
// Inicializar el estado de las cajas de sexo
const sexCheckboxes = document.querySelectorAll('.sex-checkbox');
sexCheckboxes.forEach(checkbox => {
checkbox.parentElement.style.backgroundColor = checkbox.checked ? 'rgba(255, 255, 255, 0.2)' : 'rgba(255, 255, 255, 0.0)';
});
// Manejar la selección individual de sexo
sexCheckboxes.forEach(checkbox => {
checkbox.addEventListener('change', function() {
if (!this.checked && Array.from(sexCheckboxes).filter(cb => cb.checked).length === 0) {
this.checked = true; // No permitir deseleccionar la última casilla activa
}
this.parentElement.style.backgroundColor = this.checked ? 'rgba(255, 255, 255, 0.2)' : 'rgba(255, 255, 255, 0.0)';
});
});
// Inicializar el estado de las cajas de nacionalidad
const nationalityCheckboxes = document.querySelectorAll('.nationality-checkbox');
nationalityCheckboxes.forEach(checkbox => {
checkbox.parentElement.style.backgroundColor = checkbox.checked ? 'rgba(255, 255, 255, 0.2)' : 'rgba(255, 255, 255, 0.0)';
});
// Manejar la selección individual de nacionalidad
nationalityCheckboxes.forEach(checkbox => {
checkbox.addEventListener('change', function() {
if (!this.checked && Array.from(nationalityCheckboxes).filter(cb => cb.checked).length === 0) {
this.checked = true; // No permitir deseleccionar la última casilla activa
}
this.parentElement.style.backgroundColor = this.checked ? 'rgba(255, 255, 255, 0.2)' : 'rgba(255, 255, 255, 0.0)';
});
});
});
</script>
</body>
</html>