fix: consolidate datasets and add custom legend to prevent empty columns

This commit is contained in:
Paul Gauthier (aider) 2024-12-03 16:33:27 -08:00
parent 82059bb454
commit 19004c0bad

View file

@ -20,26 +20,20 @@ document.addEventListener('DOMContentLoaded', function () {
var chartData = { var chartData = {
labels: filteredData.map(row => row.model), labels: filteredData.map(row => row.model),
datasets: [ datasets: [{
{ data: filteredData.map(row => row.pass_rate_2),
label: 'Solo model', backgroundColor: filteredData.map(row =>
data: filteredData.map(row => (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 ? 'rgba(75, 192, 192, 0.2)' // Green for solo models
), : 'rgba(54, 162, 235, 0.2)' // Blue for architect+editor
backgroundColor: 'rgba(75, 192, 192, 0.2)', // Green ),
borderColor: 'rgba(75, 192, 192, 1)', borderColor: filteredData.map(row =>
borderWidth: 1 (row.model === 'Qwen2.5 Coder 32B Instruct' || row.model === 'Sonnet (SOTA)')
}, ? 'rgba(75, 192, 192, 1)' // Green border for solo models
{ : 'rgba(54, 162, 235, 1)' // Blue border for architect+editor
label: 'Architect + Editor', ),
data: filteredData.map(row => borderWidth: 1
(row.model !== 'Qwen2.5 Coder 32B Instruct' && row.model !== 'Sonnet (SOTA)') ? row.pass_rate_2 : null }]
),
backgroundColor: 'rgba(54, 162, 235, 0.2)', // Blue
borderColor: 'rgba(54, 162, 235, 1)',
borderWidth: 1
}
]
}; };
if (chart) { if (chart) {
@ -57,6 +51,22 @@ document.addEventListener('DOMContentLoaded', function () {
labels: { labels: {
font: { font: {
size: 14 size: 14
},
generateLabels: function(chart) {
return [
{
text: 'Solo model',
fillStyle: 'rgba(75, 192, 192, 0.2)',
strokeStyle: 'rgba(75, 192, 192, 1)',
lineWidth: 1
},
{
text: 'Architect + Editor',
fillStyle: 'rgba(54, 162, 235, 0.2)',
strokeStyle: 'rgba(54, 162, 235, 1)',
lineWidth: 1
}
];
} }
} }
}, },