mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 18:25:00 +00:00
feat: Increase chart height on small screens
This commit is contained in:
parent
19073dd939
commit
8f0cc731fd
1 changed files with 18 additions and 1 deletions
|
@ -12,7 +12,9 @@ nav_exclude: true
|
||||||
# LLMs are bad at returning code in JSON
|
# LLMs are bad at returning code in JSON
|
||||||
|
|
||||||
|
|
||||||
<canvas id="passRateChart" width="800" height="400" style="margin-bottom: 20px"></canvas>
|
<div id="chartContainer" style="position: relative; height: 0; padding-bottom: 50%; margin-bottom: 20px;">
|
||||||
|
<canvas id="passRateChart" style="position: absolute; width: 100%; height: 100%;"></canvas>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
@ -56,6 +58,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||||
data: data,
|
data: data,
|
||||||
options: {
|
options: {
|
||||||
responsive: true,
|
responsive: true,
|
||||||
|
maintainAspectRatio: false,
|
||||||
scales: {
|
scales: {
|
||||||
x: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
|
@ -87,6 +90,20 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Adjust chart height based on screen width
|
||||||
|
function adjustChartHeight() {
|
||||||
|
var container = document.getElementById('chartContainer');
|
||||||
|
if (window.innerWidth < 600) {
|
||||||
|
container.style.paddingBottom = '75%'; // Increase height on small screens
|
||||||
|
} else {
|
||||||
|
container.style.paddingBottom = '50%'; // Default height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call the function initially and on window resize
|
||||||
|
adjustChartHeight();
|
||||||
|
window.addEventListener('resize', adjustChartHeight);
|
||||||
|
|
||||||
function createStripedCanvas(isStrict) {
|
function createStripedCanvas(isStrict) {
|
||||||
const patternCanvas = document.createElement('canvas');
|
const patternCanvas = document.createElement('canvas');
|
||||||
const patternContext = patternCanvas.getContext('2d');
|
const patternContext = patternCanvas.getContext('2d');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue