Spaces:
Running
Running
File size: 12,926 Bytes
e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e 1265936 b395e0e e86c10c b395e0e e86c10c b395e0e e86c10c b395e0e 1265936 b395e0e 1265936 b395e0e 1265936 b395e0e 1265936 b395e0e 1265936 b395e0e 1265936 b395e0e 1265936 b395e0e 1265936 e86c10c b395e0e e86c10c 66a90a7 e86c10c b395e0e e86c10c b395e0e e86c10c 66a90a7 e86c10c 66a90a7 e86c10c 66a90a7 e86c10c 66a90a7 e86c10c 66a90a7 e86c10c |
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 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interactive Air Pollution Map - India CAMS Dashboard</title>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
}
.container {
max-width: 1400px;
margin: 0 auto;
padding: 20px;
}
.header {
background: rgba(255, 255, 255, 0.95);
border-radius: 15px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
backdrop-filter: blur(4px);
border: 1px solid rgba(255, 255, 255, 0.18);
}
.header h1 {
color: #2c3e50;
margin-bottom: 10px;
text-align: center;
}
.plot-container {
background: rgba(255, 255, 255, 0.95);
border-radius: 15px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
backdrop-filter: blur(4px);
border: 1px solid rgba(255, 255, 255, 0.18);
}
.plot-info {
background: rgba(255, 255, 255, 0.95);
border-radius: 15px;
padding: 20px;
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
backdrop-filter: blur(4px);
border: 1px solid rgba(255, 255, 255, 0.18);
}
.info-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 15px;
margin-bottom: 20px;
}
.info-item {
background: rgba(52, 73, 94, 0.1);
padding: 15px;
border-radius: 10px;
border-left: 4px solid #3498db;
}
.info-item h3 {
color: #2c3e50;
margin-bottom: 5px;
font-size: 14px;
font-weight: 600;
}
.info-item p {
color: #34495e;
font-size: 16px;
font-weight: 500;
}
.controls {
display: flex;
gap: 15px;
flex-wrap: wrap;
margin-bottom: 20px;
}
.btn {
background: linear-gradient(45deg, #3498db, #2980b9);
color: white;
padding: 12px 24px;
border: none;
border-radius: 25px;
text-decoration: none;
font-weight: 600;
transition: all 0.3s ease;
cursor: pointer;
font-size: 14px;
}
.btn:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}
.btn-download {
background: linear-gradient(45deg, #27ae60, #219a52);
}
.btn-back {
background: linear-gradient(45deg, #95a5a6, #7f8c8d);
}
.instructions {
background: rgba(255, 255, 255, 0.95);
border-radius: 15px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
backdrop-filter: blur(4px);
border: 1px solid rgba(255, 255, 255, 0.18);
}
.instructions h3 {
color: #2c3e50;
margin-bottom: 15px;
}
.instructions ul {
color: #34495e;
}
.btn-download:hover {
box-shadow: 0 8px 25px rgba(39, 174, 96, 0.4);
}
.btn-back {
background: linear-gradient(45deg, #95a5a6, #7f8c8d);
}
.btn-back:hover {
box-shadow: 0 8px 25px rgba(149, 165, 166, 0.4);
}
.instructions {
background: rgba(241, 196, 15, 0.1);
border: 2px solid rgba(241, 196, 15, 0.3);
border-radius: 10px;
padding: 15px;
margin-bottom: 20px;
}
.instructions h3 {
color: #f39c12;
margin-bottom: 10px;
}
.instructions ul {
color: #34495e;
padding-left: 20px;
}
.instructions li {
margin-bottom: 5px;
}
.interactive-plot {
border-radius: 10px;
overflow: hidden;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
@media (max-width: 768px) {
.container {
padding: 10px;
}
.controls {
justify-content: center;
}
.btn {
padding: 10px 20px;
font-size: 12px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>π Interactive Air Pollution Map</h1>
<p style="text-align: center; color: #7f8c8d; margin-top: 10px;">
Hover over the map to see exact coordinates and pollution values. Use the toolbar to zoom, pan, and download.
</p>
</div>
<div class="instructions">
<h3>π― How to Use This Interactive Map:</h3>
<ul>
<li><strong>π±οΈ Hover:</strong> Move your mouse over any point to see exact coordinates, pollution values, and location data</li>
<li><strong>π Zoom:</strong> Use mouse wheel, zoom buttons in toolbar, or draw a rectangle to zoom to specific area</li>
<li><strong>π Pan:</strong> Click and drag to move around the map</li>
<li><strong>π₯ Download:</strong> Click the camera icon in the toolbar to download as PNG image</li>
<li><strong>π Reset:</strong> Double-click anywhere to reset zoom to original view</li>
<li><strong>βοΈ Annotate:</strong> Use drawing tools in the toolbar to add lines, shapes, and annotations</li>
</ul>
</div>
<div class="controls">
<a href="{{ url_for('index') }}" class="btn btn-back">β Back to Dashboard</a>
{% if plot_info.png_path %}
<a href="{{ url_for('serve_plot', filename=plot_info.png_path.split('/')[-1]) }}"
class="btn btn-download" download>π₯ Download PNG</a>
{% endif %}
{% if plot_info.html_path %}
<a href="{{ url_for('serve_plot', filename=plot_info.html_path.split('/')[-1]) }}"
class="btn btn-download" download>π Download HTML</a>
{% endif %}
</div>
<div class="plot-container">
<div class="interactive-plot" id="plotly-container">
{{ plot_html|safe }}
</div>
</div>
<div class="plot-info">
<h2 style="color: #2c3e50; margin-bottom: 20px;">π Plot Information</h2>
<div class="info-grid">
<div class="info-item">
<h3>π§ͺ Variable</h3>
<p>{{ plot_info.variable }}</p>
</div>
{% if plot_info.units %}
<div class="info-item">
<h3>π Units</h3>
<p>{{ plot_info.units }}</p>
</div>
{% endif %}
{% if plot_info.pressure_level %}
<div class="info-item">
<h3>π‘οΈ Pressure Level</h3>
<p>{{ plot_info.pressure_level }} hPa</p>
</div>
{% endif %}
<div class="info-item">
<h3>π¨ Color Theme</h3>
<p>{{ plot_info.color_theme }}</p>
</div>
<div class="info-item">
<h3>π Data Shape</h3>
<p>{{ plot_info.shape }}</p>
</div>
<div class="info-item">
<h3>β° Generated</h3>
<p>{{ plot_info.generated_time }}</p>
</div>
<!-- </div>
<div class="info-grid"> -->
<div class="info-item">
<h3>π Minimum Value</h3>
<p>{{ "%.3f"|format(plot_info.data_range.min) }}{% if plot_info.units %} {{ plot_info.units }}{% endif %}</p>
</div>
<div class="info-item">
<h3>π Maximum Value</h3>
<p>{{ "%.3f"|format(plot_info.data_range.max) }}{% if plot_info.units %} {{ plot_info.units }}{% endif %}</p>
</div>
<div class="info-item">
<h3>π Average Value</h3>
<p>{{ "%.3f"|format(plot_info.data_range.mean) }}{% if plot_info.units %} {{ plot_info.units }}{% endif %}</p>
</div>
</div>
</div>
</div>
<script>
// Additional interactivity enhancements and debugging
document.addEventListener('DOMContentLoaded', function() {
console.log('Interactive plot page loaded');
// Check if Plotly is loaded
if (typeof Plotly === 'undefined') {
console.error('Plotly is not loaded!');
document.getElementById('plotly-container').innerHTML =
'<div style="padding: 40px; text-align: center; color: red; border: 2px dashed red; margin: 20px;">' +
'<h3>β οΈ Plot Loading Error</h3>' +
'<p>Plotly library failed to load. Please refresh the page or check your internet connection.</p>' +
'</div>';
return;
}
// Look for the plotly div
const plotDiv = document.querySelector('[id^="interactive-plot"]') || document.querySelector('.plotly-graph-div');
if (!plotDiv) {
console.error('No Plotly div found!');
document.getElementById('plotly-container').innerHTML =
'<div style="padding: 40px; text-align: center; color: orange; border: 2px dashed orange; margin: 20px;">' +
'<h3>β οΈ Plot Not Found</h3>' +
'<p>The interactive plot could not be initialized. The data may be processing.</p>' +
'<button onclick="location.reload()" style="padding: 10px 20px; background: #3498db; color: white; border: none; border-radius: 5px; cursor: pointer;">π Refresh Page</button>' +
'</div>';
return;
}
console.log('Plotly div found:', plotDiv);
// Add responsive behavior
window.addEventListener('resize', function() {
if (plotDiv && typeof Plotly !== 'undefined') {
Plotly.Plots.resize(plotDiv);
}
});
// Add loading indicator for downloads
const downloadButtons = document.querySelectorAll('.btn-download');
downloadButtons.forEach(button => {
button.addEventListener('click', function() {
const originalText = this.textContent;
this.textContent = 'β³ Preparing download...';
this.style.pointerEvents = 'none';
setTimeout(() => {
this.textContent = originalText;
this.style.pointerEvents = 'auto';
}, 2000);
});
});
// Add a small delay then check if plot rendered correctly
setTimeout(function() {
const plotlyGraphDiv = document.querySelector('.plotly-graph-div');
if (plotlyGraphDiv) {
const svg = plotlyGraphDiv.querySelector('svg');
if (!svg || svg.children.length === 0) {
console.warn('Plot may not have rendered correctly');
// Try to redraw
if (typeof Plotly !== 'undefined' && plotDiv._fullData) {
Plotly.redraw(plotDiv);
}
} else {
console.log('Plot rendered successfully');
}
}
}, 1000);
});
</script>
</body>
</html> |