|
4 | 4 | <link rel="stylesheet" href="../../css/spectre-icons.min.css"> |
5 | 5 | <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" /> |
6 | 6 | <style> |
7 | | - .leaflet-map, .chart-canvas, .chart-wrapper { |
| 7 | + .leaflet-map { |
8 | 8 | width: 100%; |
9 | 9 | aspect-ratio: 1/1; |
10 | 10 | } |
| 11 | + .chart-canvas { |
| 12 | + width: 100%; |
| 13 | + display: block; |
| 14 | + } |
| 15 | + .chart-wrapper { |
| 16 | + width: 100%; |
| 17 | + position: relative; |
| 18 | + } |
11 | 19 | .leaflet-map, .chart-container { |
12 | 20 | border-radius: 4px; |
13 | 21 | box-shadow: 0 2px 4px rgba(0,0,0,0.1); |
|
35 | 43 | .chart-header:hover { background: #e9ecef; } |
36 | 44 | .chart-title { font-weight: 600; color: #333; margin: 0; } |
37 | 45 | .chart-toggle { float: right; font-size: 14px; color: #666; } |
38 | | - .chart-content { padding: 15px; overflow: hidden; } |
| 46 | + .chart-content { padding: 15px; } |
39 | 47 | .chart-content.collapsed { display: none; } |
40 | | - .chart-canvas { margin-bottom: 10px; } |
| 48 | + .chart-wrapper { margin-bottom: 10px; } |
41 | 49 | .chart-export { text-align: right; margin-top: 10px; } |
42 | 50 | .chart-export button { font-size: 0.85em; padding: 4px 8px; } |
43 | 51 | .no-data-message { text-align: center; color: #666; font-style: italic; padding: 20px; } |
|
339 | 347 | requestAnimationFrame(() => { |
340 | 348 | availableCharts.forEach(({ type, id }) => { |
341 | 349 | try { |
342 | | - trackCharts[trackNumber][id] = createChart(type, `canvas-${id}-${trackNumber}`, trackData); |
| 350 | + const chart = createChart(type, `canvas-${id}-${trackNumber}`, trackData); |
| 351 | + trackCharts[trackNumber][id] = chart; |
| 352 | + |
| 353 | + // Set canvas height to match its width for square charts |
| 354 | + if (chart) { |
| 355 | + const canvas = document.getElementById(`canvas-${id}-${trackNumber}`); |
| 356 | + if (canvas) { |
| 357 | + canvas.style.height = canvas.offsetWidth + 'px'; |
| 358 | + chart.resize(); |
| 359 | + } |
| 360 | + } |
343 | 361 | } catch (e) { |
344 | 362 | console.error(`Error creating ${type} chart:`, e); |
345 | 363 | } |
|
0 commit comments