feat: add color-coded legend to chart for model types

This commit is contained in:
Paul Gauthier (aider) 2024-12-03 16:32:11 -08:00
parent 3fc846471e
commit 82059bb454

View file

@ -20,23 +20,26 @@ document.addEventListener('DOMContentLoaded', function () {
var chartData = { var chartData = {
labels: filteredData.map(row => row.model), labels: filteredData.map(row => row.model),
datasets: [{ datasets: [
label: 'Percent completed correctly', {
data: filteredData.map(row => row.pass_rate_2), label: 'Solo model',
backgroundColor: filteredData.map(row => { data: filteredData.map(row =>
if (row.model === 'Qwen2.5 Coder 32B Instruct' || row.model === 'Sonnet (SOTA)') { (row.model === 'Qwen2.5 Coder 32B Instruct' || row.model === 'Sonnet (SOTA)') ? row.pass_rate_2 : null
return 'rgba(75, 192, 192, 0.2)'; // Green color for both ),
} backgroundColor: 'rgba(75, 192, 192, 0.2)', // Green
return 'rgba(54, 162, 235, 0.2)'; // Default blue borderColor: 'rgba(75, 192, 192, 1)',
}), borderWidth: 1
borderColor: filteredData.map(row => { },
if (row.model === 'Qwen2.5 Coder 32B Instruct' || row.model === 'Sonnet (SOTA)') { {
return 'rgba(75, 192, 192, 1)'; // Green border for both label: 'Architect + Editor',
} data: filteredData.map(row =>
return 'rgba(54, 162, 235, 1)'; // Default blue border (row.model !== 'Qwen2.5 Coder 32B Instruct' && row.model !== 'Sonnet (SOTA)') ? row.pass_rate_2 : null
}), ),
borderWidth: 1 backgroundColor: 'rgba(54, 162, 235, 0.2)', // Blue
}] borderColor: 'rgba(54, 162, 235, 1)',
borderWidth: 1
}
]
}; };
if (chart) { if (chart) {
@ -49,7 +52,13 @@ document.addEventListener('DOMContentLoaded', function () {
options: { options: {
plugins: { plugins: {
legend: { legend: {
display: false display: true,
position: 'top',
labels: {
font: {
size: 14
}
}
}, },
title: { title: {
display: true, display: true,