Revert "refactor: Improve chart responsiveness with dynamic mobile height"

This reverts commit 46eee9e642.
This commit is contained in:
Paul Gauthier 2025-03-11 12:37:56 -07:00
parent 46eee9e642
commit 8cfbc9b827

View file

@ -9,7 +9,7 @@
.chart-container {
position: relative;
width: 100%;
min-height: 300px;
height: 300px;
}
</style>
@ -18,21 +18,8 @@
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-moment"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
var blameCanvas = document.getElementById('blameChart');
var linesCanvas = document.getElementById('linesChart');
var blameCtx = blameCanvas.getContext('2d');
var linesCtx = linesCanvas.getContext('2d');
function getChartHeight() {
var width = window.innerWidth;
// For mobile (smaller screens), make charts taller
return width < 768 ? 400 : 300;
}
// Set initial heights
document.querySelectorAll('.chart-container').forEach(function(container) {
container.style.height = getChartHeight() + 'px';
});
var blameCtx = document.getElementById('blameChart').getContext('2d');
var linesCtx = document.getElementById('linesChart').getContext('2d');
var labels = [{% for row in site.data.blame %}'{{ row.end_tag }}',{% endfor %}];
@ -167,15 +154,5 @@ document.addEventListener('DOMContentLoaded', function () {
}
}
});
// Handle window resize
window.addEventListener('resize', function() {
var newHeight = getChartHeight();
document.querySelectorAll('.chart-container').forEach(function(container) {
container.style.height = newHeight + 'px';
});
blameChart.resize();
linesChart.resize();
});
});
</script>