Skip to content

Commit ecee7a6

Browse files
committed
recorder: fix chart sizing
1 parent dc1926e commit ecee7a6

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

apps/recorder/interface.html

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@
44
<link rel="stylesheet" href="../../css/spectre-icons.min.css">
55
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
66
<style>
7-
.leaflet-map, .chart-canvas, .chart-wrapper {
7+
.leaflet-map {
88
width: 100%;
99
aspect-ratio: 1/1;
1010
}
11+
.chart-canvas {
12+
width: 100%;
13+
display: block;
14+
}
15+
.chart-wrapper {
16+
width: 100%;
17+
position: relative;
18+
}
1119
.leaflet-map, .chart-container {
1220
border-radius: 4px;
1321
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
@@ -35,9 +43,9 @@
3543
.chart-header:hover { background: #e9ecef; }
3644
.chart-title { font-weight: 600; color: #333; margin: 0; }
3745
.chart-toggle { float: right; font-size: 14px; color: #666; }
38-
.chart-content { padding: 15px; overflow: hidden; }
46+
.chart-content { padding: 15px; }
3947
.chart-content.collapsed { display: none; }
40-
.chart-canvas { margin-bottom: 10px; }
48+
.chart-wrapper { margin-bottom: 10px; }
4149
.chart-export { text-align: right; margin-top: 10px; }
4250
.chart-export button { font-size: 0.85em; padding: 4px 8px; }
4351
.no-data-message { text-align: center; color: #666; font-style: italic; padding: 20px; }
@@ -339,7 +347,17 @@
339347
requestAnimationFrame(() => {
340348
availableCharts.forEach(({ type, id }) => {
341349
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+
}
343361
} catch (e) {
344362
console.error(`Error creating ${type} chart:`, e);
345363
}

0 commit comments

Comments
 (0)