Update index.html
Browse files- index.html +135 -133
index.html
CHANGED
|
@@ -3,215 +3,217 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>
|
| 7 |
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css"/>
|
| 8 |
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
|
| 9 |
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 10 |
<style>
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
.chart-container {
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
}
|
| 33 |
|
| 34 |
-
|
| 35 |
-
width: 100%;
|
| 36 |
-
height:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
}
|
| 38 |
-
}
|
| 39 |
</style>
|
| 40 |
</head>
|
| 41 |
<body>
|
| 42 |
|
| 43 |
-
<
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
<
|
| 48 |
-
<
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
<
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
</div>
|
| 62 |
|
| 63 |
<script>
|
| 64 |
-
|
| 65 |
var locations = [
|
| 66 |
-
{ name: "Ragusa", coords: [36.9257, 14.7244], category: "operative", connections: 24, avgSupportTime: 12 },
|
| 67 |
-
{ name: "Seville", coords: [37.3886, -5.9823], category: "operative", connections: 9, avgSupportTime: 1 },
|
| 68 |
-
{ name: "Groningen", coords: [53.2194, 6.5665], category: "operative", connections: 13, avgSupportTime: 3 },
|
| 69 |
-
{ name: "Cape Town", coords: [-33.9249, 18.4241], category: "operative", connections: 1, avgSupportTime: 0 },
|
| 70 |
-
{ name: "Bern", coords: [46.9481, 7.4474], category: "operative", connections: 0, avgSupportTime: 0 },
|
| 71 |
-
{ name: "Kiel", coords: [54.3233, 10.1228], category: "removed", connections: 0, avgSupportTime: 0 },
|
| 72 |
-
{ name: "Le Mans", coords: [
|
| 73 |
-
{ name: "
|
| 74 |
-
{ name: "Gdansk", coords: [54.3520, 18.6466], category: "assessment", connections: 0, avgSupportTime: 0 }, // Gdansk, Polonia
|
| 75 |
-
{ name: "Prague", coords: [50.0755, 14.4378], category: "assessment", connections: 0, avgSupportTime: 0 }, // Praga, República Checa
|
| 76 |
-
{ name: "Kuwait", coords: [29.3759, 47.9774], category: "assessment", connections: 0, avgSupportTime: 0 } // Kuwait, Kuwait
|
| 77 |
];
|
| 78 |
|
| 79 |
-
var map = L.map('map').setView([50.0755, 14.4378], 3);
|
| 80 |
|
| 81 |
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
| 82 |
attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
| 83 |
}).addTo(map);
|
| 84 |
|
| 85 |
var categoryColors = {
|
| 86 |
-
"assessment": "
|
| 87 |
-
"deployment": "
|
| 88 |
-
"operative": "
|
| 89 |
-
"paused": "
|
| 90 |
-
"maintenance": "
|
| 91 |
-
"removed": "
|
| 92 |
};
|
| 93 |
|
| 94 |
var markers = [];
|
| 95 |
-
var chart1 = null;
|
| 96 |
-
var chart2 = null;
|
| 97 |
|
| 98 |
function updateMarkers() {
|
| 99 |
var selectedCategory = document.getElementById("category").value;
|
| 100 |
|
| 101 |
-
// Eliminar marcadores existentes
|
| 102 |
markers.forEach(marker => map.removeLayer(marker));
|
| 103 |
markers = [];
|
| 104 |
|
| 105 |
-
// Filtrar y agregar los marcadores
|
| 106 |
var filteredLocations = locations.filter(location => selectedCategory === "all" || location.category === selectedCategory);
|
| 107 |
-
|
| 108 |
filteredLocations.forEach(location => {
|
| 109 |
var marker = L.circleMarker(location.coords, {
|
| 110 |
color: categoryColors[location.category],
|
| 111 |
fillColor: categoryColors[location.category],
|
| 112 |
fillOpacity: 0.8,
|
| 113 |
radius: 8
|
| 114 |
-
}).bindPopup(`
|
| 115 |
-
<b>${location.name}</b><br>
|
| 116 |
-
Categoría: ${location.category}<br>
|
| 117 |
-
Conexiones remotas: ${location.connections}<br>
|
| 118 |
-
Tiempo medio de soporte: ${location.avgSupportTime} hrs
|
| 119 |
-
`); // Popup con detalles adicionales
|
| 120 |
|
| 121 |
-
marker.on('mouseover', function() {
|
| 122 |
-
marker.openPopup(); // Mostrar el popup cuando se pasa el mouse
|
| 123 |
-
});
|
| 124 |
-
|
| 125 |
-
marker.on('mouseout', function() {
|
| 126 |
-
marker.closePopup(); // Cerrar el popup cuando se deja de pasar el mouse
|
| 127 |
-
});
|
| 128 |
-
|
| 129 |
marker.addTo(map);
|
| 130 |
markers.push(marker);
|
| 131 |
});
|
| 132 |
|
| 133 |
-
// Ajustar el zoom
|
| 134 |
if (markers.length > 1) {
|
| 135 |
var group = new L.featureGroup(markers);
|
| 136 |
map.fitBounds(group.getBounds());
|
| 137 |
} else if (markers.length === 1) {
|
| 138 |
-
|
| 139 |
-
map.setView(markers[0].getLatLng(), zoom_nivel_pais);
|
| 140 |
} else {
|
| 141 |
-
map.setView([45, 10], 3);
|
| 142 |
}
|
| 143 |
|
| 144 |
-
// Actualizar los gráficos
|
| 145 |
updateCharts(filteredLocations);
|
| 146 |
}
|
| 147 |
|
| 148 |
function updateCharts(filteredLocations) {
|
| 149 |
-
// Obtener los datos para los gráficos
|
| 150 |
var cityNames = filteredLocations.map(location => location.name);
|
| 151 |
var connectionsData = filteredLocations.map(location => location.connections);
|
| 152 |
var avgSupportTimeData = filteredLocations.map(location => location.avgSupportTime);
|
| 153 |
var categoryColorsData = filteredLocations.map(location => categoryColors[location.category]);
|
| 154 |
|
| 155 |
-
// Si los gráficos ya existen, destruirlos y crear nuevos
|
| 156 |
if (chart1) chart1.destroy();
|
| 157 |
if (chart2) chart2.destroy();
|
| 158 |
|
| 159 |
-
// Crear el gráfico de conexiones
|
| 160 |
var ctx1 = document.getElementById('connectionsChart').getContext('2d');
|
| 161 |
chart1 = new Chart(ctx1, {
|
| 162 |
type: 'bar',
|
| 163 |
-
data: {
|
| 164 |
-
labels: cityNames,
|
| 165 |
-
datasets: [{
|
| 166 |
-
label: 'Remote Connections',
|
| 167 |
-
data: connectionsData,
|
| 168 |
-
backgroundColor: categoryColorsData, // Asignar color según categoría
|
| 169 |
-
borderColor: categoryColorsData, // Asignar color según categoría
|
| 170 |
-
borderWidth: 1
|
| 171 |
-
}]
|
| 172 |
-
},
|
| 173 |
-
options: {
|
| 174 |
-
responsive: true,
|
| 175 |
-
scales: {
|
| 176 |
-
y: {
|
| 177 |
-
beginAtZero: true,
|
| 178 |
-
ticks: {
|
| 179 |
-
stepSize: 1
|
| 180 |
-
}
|
| 181 |
-
}
|
| 182 |
-
}
|
| 183 |
-
}
|
| 184 |
});
|
| 185 |
|
| 186 |
-
// Crear el gráfico de tiempo de soporte
|
| 187 |
var ctx2 = document.getElementById('supportTimeChart').getContext('2d');
|
| 188 |
chart2 = new Chart(ctx2, {
|
| 189 |
type: 'bar',
|
| 190 |
-
data: {
|
| 191 |
-
labels: cityNames,
|
| 192 |
-
datasets: [{
|
| 193 |
-
label: 'Average Monthly Support Time (hrs)',
|
| 194 |
-
data: avgSupportTimeData,
|
| 195 |
-
backgroundColor: categoryColorsData, // Asignar color según categoría
|
| 196 |
-
borderColor: categoryColorsData, // Asignar color según categoría
|
| 197 |
-
borderWidth: 1
|
| 198 |
-
}]
|
| 199 |
-
},
|
| 200 |
-
options: {
|
| 201 |
-
responsive: true,
|
| 202 |
-
scales: {
|
| 203 |
-
y: {
|
| 204 |
-
beginAtZero: true,
|
| 205 |
-
ticks: {
|
| 206 |
-
stepSize: 1
|
| 207 |
-
}
|
| 208 |
-
}
|
| 209 |
-
}
|
| 210 |
-
}
|
| 211 |
});
|
| 212 |
}
|
| 213 |
|
| 214 |
-
// Mostrar todos los marcadores y gráficos al inicio
|
| 215 |
updateMarkers();
|
| 216 |
</script>
|
| 217 |
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Boston Scientific Dashboard</title>
|
| 7 |
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css"/>
|
| 8 |
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
|
| 9 |
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 10 |
<style>
|
| 11 |
+
/* Paleta de colores corporativa */
|
| 12 |
+
:root {
|
| 13 |
+
--primary-blue: #0057b8;
|
| 14 |
+
--secondary-blue: #003f7f;
|
| 15 |
+
--light-gray: #f4f4f4;
|
| 16 |
+
--dark-gray: #333;
|
| 17 |
+
--highlight-yellow: #FFD700;
|
| 18 |
+
--danger-red: #FF0000;
|
| 19 |
+
--success-green: #008000;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
/* Estilos generales */
|
| 23 |
+
body {
|
| 24 |
+
font-family: Arial, sans-serif;
|
| 25 |
+
background-color: var(--light-gray);
|
| 26 |
+
color: var(--dark-gray);
|
| 27 |
+
margin: 0;
|
| 28 |
+
padding: 0;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
h1 {
|
| 32 |
+
text-align: center;
|
| 33 |
+
color: var(--primary-blue);
|
| 34 |
+
margin: 20px 0;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
/* Contenedor principal con grid */
|
| 38 |
+
.dashboard {
|
| 39 |
+
display: grid;
|
| 40 |
+
grid-template-columns: 1fr;
|
| 41 |
+
grid-template-rows: auto auto auto;
|
| 42 |
+
gap: 20px;
|
| 43 |
+
padding: 20px;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/* Controles */
|
| 47 |
+
#controls {
|
| 48 |
+
display: flex;
|
| 49 |
+
justify-content: center;
|
| 50 |
+
align-items: center;
|
| 51 |
+
background: white;
|
| 52 |
+
padding: 10px;
|
| 53 |
+
border-radius: 10px;
|
| 54 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
select {
|
| 58 |
+
padding: 8px;
|
| 59 |
+
font-size: 16px;
|
| 60 |
+
border: 2px solid var(--primary-blue);
|
| 61 |
+
border-radius: 5px;
|
| 62 |
+
background: white;
|
| 63 |
+
color: var(--dark-gray);
|
| 64 |
+
cursor: pointer;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
/* Estilos del mapa */
|
| 68 |
+
#map {
|
| 69 |
+
height: 500px;
|
| 70 |
+
width: 100%;
|
| 71 |
+
border-radius: 10px;
|
| 72 |
+
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
/* Contenedor de gráficos */
|
| 76 |
.chart-container {
|
| 77 |
+
display: grid;
|
| 78 |
+
grid-template-columns: repeat(2, 1fr);
|
| 79 |
+
gap: 20px;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
.chart-box {
|
| 83 |
+
background: white;
|
| 84 |
+
padding: 20px;
|
| 85 |
+
border-radius: 10px;
|
| 86 |
+
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
|
| 87 |
}
|
| 88 |
|
| 89 |
+
canvas {
|
| 90 |
+
width: 100%;
|
| 91 |
+
height: 300px;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
/* Responsive */
|
| 95 |
+
@media (max-width: 768px) {
|
| 96 |
+
.chart-container {
|
| 97 |
+
grid-template-columns: 1fr;
|
| 98 |
+
}
|
| 99 |
}
|
|
|
|
| 100 |
</style>
|
| 101 |
</head>
|
| 102 |
<body>
|
| 103 |
|
| 104 |
+
<h1>Matrix - Dashboard</h1>
|
| 105 |
+
|
| 106 |
+
<div class="dashboard">
|
| 107 |
+
<div id="controls">
|
| 108 |
+
<label for="category">Status:</label>
|
| 109 |
+
<select id="category" onchange="updateMarkers()">
|
| 110 |
+
<option value="all">All</option>
|
| 111 |
+
<option value="assessment">Assessment</option>
|
| 112 |
+
<option value="deployment">In Deployment</option>
|
| 113 |
+
<option value="operative">Operative</option>
|
| 114 |
+
<option value="paused">Paused</option>
|
| 115 |
+
<option value="maintenance">Maintenance</option>
|
| 116 |
+
<option value="removed">Removed</option>
|
| 117 |
+
</select>
|
| 118 |
+
</div>
|
| 119 |
+
|
| 120 |
+
<div id="map"></div>
|
| 121 |
+
|
| 122 |
+
<div class="chart-container">
|
| 123 |
+
<div class="chart-box">
|
| 124 |
+
<canvas id="connectionsChart"></canvas>
|
| 125 |
+
</div>
|
| 126 |
+
<div class="chart-box">
|
| 127 |
+
<canvas id="supportTimeChart"></canvas>
|
| 128 |
+
</div>
|
| 129 |
+
</div>
|
| 130 |
</div>
|
| 131 |
|
| 132 |
<script>
|
|
|
|
| 133 |
var locations = [
|
| 134 |
+
{ name: "Ragusa", coords: [36.9257, 14.7244], category: "operative", connections: 24, avgSupportTime: 12 },
|
| 135 |
+
{ name: "Seville", coords: [37.3886, -5.9823], category: "operative", connections: 9, avgSupportTime: 1 },
|
| 136 |
+
{ name: "Groningen", coords: [53.2194, 6.5665], category: "operative", connections: 13, avgSupportTime: 3 },
|
| 137 |
+
{ name: "Cape Town", coords: [-33.9249, 18.4241], category: "operative", connections: 1, avgSupportTime: 0 },
|
| 138 |
+
{ name: "Bern", coords: [46.9481, 7.4474], category: "operative", connections: 0, avgSupportTime: 0 },
|
| 139 |
+
{ name: "Kiel", coords: [54.3233, 10.1228], category: "removed", connections: 0, avgSupportTime: 0 },
|
| 140 |
+
{ name: "Le Mans", coords: [48.0077, 0.1996], category: "assessment", connections: 0, avgSupportTime: 0 },
|
| 141 |
+
{ name: "Gdansk", coords: [54.3520, 18.6466], category: "assessment", connections: 0, avgSupportTime: 0 }
|
|
|
|
|
|
|
|
|
|
| 142 |
];
|
| 143 |
|
| 144 |
+
var map = L.map('map').setView([50.0755, 14.4378], 3);
|
| 145 |
|
| 146 |
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
| 147 |
attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
| 148 |
}).addTo(map);
|
| 149 |
|
| 150 |
var categoryColors = {
|
| 151 |
+
"assessment": "#0057b8",
|
| 152 |
+
"deployment": "#008000",
|
| 153 |
+
"operative": "#008000",
|
| 154 |
+
"paused": "#FFD700",
|
| 155 |
+
"maintenance": "#FFA500",
|
| 156 |
+
"removed": "#FF0000"
|
| 157 |
};
|
| 158 |
|
| 159 |
var markers = [];
|
| 160 |
+
var chart1 = null;
|
| 161 |
+
var chart2 = null;
|
| 162 |
|
| 163 |
function updateMarkers() {
|
| 164 |
var selectedCategory = document.getElementById("category").value;
|
| 165 |
|
|
|
|
| 166 |
markers.forEach(marker => map.removeLayer(marker));
|
| 167 |
markers = [];
|
| 168 |
|
|
|
|
| 169 |
var filteredLocations = locations.filter(location => selectedCategory === "all" || location.category === selectedCategory);
|
| 170 |
+
|
| 171 |
filteredLocations.forEach(location => {
|
| 172 |
var marker = L.circleMarker(location.coords, {
|
| 173 |
color: categoryColors[location.category],
|
| 174 |
fillColor: categoryColors[location.category],
|
| 175 |
fillOpacity: 0.8,
|
| 176 |
radius: 8
|
| 177 |
+
}).bindPopup(`<b>${location.name}</b><br>Categoría: ${location.category}<br>Conexiones: ${location.connections}<br>Soporte: ${location.avgSupportTime} hrs`);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
marker.addTo(map);
|
| 180 |
markers.push(marker);
|
| 181 |
});
|
| 182 |
|
|
|
|
| 183 |
if (markers.length > 1) {
|
| 184 |
var group = new L.featureGroup(markers);
|
| 185 |
map.fitBounds(group.getBounds());
|
| 186 |
} else if (markers.length === 1) {
|
| 187 |
+
map.setView(markers[0].getLatLng(), 6);
|
|
|
|
| 188 |
} else {
|
| 189 |
+
map.setView([45, 10], 3);
|
| 190 |
}
|
| 191 |
|
|
|
|
| 192 |
updateCharts(filteredLocations);
|
| 193 |
}
|
| 194 |
|
| 195 |
function updateCharts(filteredLocations) {
|
|
|
|
| 196 |
var cityNames = filteredLocations.map(location => location.name);
|
| 197 |
var connectionsData = filteredLocations.map(location => location.connections);
|
| 198 |
var avgSupportTimeData = filteredLocations.map(location => location.avgSupportTime);
|
| 199 |
var categoryColorsData = filteredLocations.map(location => categoryColors[location.category]);
|
| 200 |
|
|
|
|
| 201 |
if (chart1) chart1.destroy();
|
| 202 |
if (chart2) chart2.destroy();
|
| 203 |
|
|
|
|
| 204 |
var ctx1 = document.getElementById('connectionsChart').getContext('2d');
|
| 205 |
chart1 = new Chart(ctx1, {
|
| 206 |
type: 'bar',
|
| 207 |
+
data: { labels: cityNames, datasets: [{ label: 'Remote Connections', data: connectionsData, backgroundColor: categoryColorsData }] }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
});
|
| 209 |
|
|
|
|
| 210 |
var ctx2 = document.getElementById('supportTimeChart').getContext('2d');
|
| 211 |
chart2 = new Chart(ctx2, {
|
| 212 |
type: 'bar',
|
| 213 |
+
data: { labels: cityNames, datasets: [{ label: 'Average Monthly Support Time (hrs)', data: avgSupportTimeData, backgroundColor: categoryColorsData }] }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
});
|
| 215 |
}
|
| 216 |
|
|
|
|
| 217 |
updateMarkers();
|
| 218 |
</script>
|
| 219 |
|