feat: Add different colors for 'whole' and 'diff' edit formats in leaderboard graph

This commit is contained in:
Paul Gauthier (aider) 2024-09-12 15:10:32 -07:00
parent 4598a376fd
commit 2605d44db6

View file

@ -7,8 +7,8 @@
datasets: [{ datasets: [{
label: 'Percent completed correctly', label: 'Percent completed correctly',
data: [], data: [],
backgroundColor: 'rgba(54, 162, 235, 0.2)', backgroundColor: [],
borderColor: 'rgba(54, 162, 235, 1)', borderColor: [],
borderWidth: 1 borderWidth: 1
}] }]
}; };
@ -18,7 +18,8 @@
allData.push({ allData.push({
model: '{{ row.model }}', model: '{{ row.model }}',
pass_rate: {{ row[include.pass_rate_key] }}, pass_rate: {{ row[include.pass_rate_key] }},
percent_cases_well_formed: {{ row.percent_cases_well_formed }} percent_cases_well_formed: {{ row.percent_cases_well_formed }},
edit_format: '{{ row.edit_format }}'
}); });
{% endfor %} {% endfor %}
@ -28,6 +29,8 @@
leaderboardData.labels = []; leaderboardData.labels = [];
leaderboardData.datasets[0].data = []; leaderboardData.datasets[0].data = [];
leaderboardData.datasets[0].backgroundColor = [];
leaderboardData.datasets[0].borderColor = [];
allData.forEach(function(row, index) { allData.forEach(function(row, index) {
var rowElement = document.getElementById('{{ include.row_prefix }}-' + index); var rowElement = document.getElementById('{{ include.row_prefix }}-' + index);
@ -37,6 +40,14 @@
if (showAll || rowElement.classList.contains('selected')) { if (showAll || rowElement.classList.contains('selected')) {
leaderboardData.labels.push(row.model); leaderboardData.labels.push(row.model);
leaderboardData.datasets[0].data.push(row.pass_rate); leaderboardData.datasets[0].data.push(row.pass_rate);
if (row.edit_format === 'whole') {
leaderboardData.datasets[0].backgroundColor.push('rgba(255, 99, 132, 0.2)');
leaderboardData.datasets[0].borderColor.push('rgba(255, 99, 132, 1)');
} else {
leaderboardData.datasets[0].backgroundColor.push('rgba(54, 162, 235, 0.2)');
leaderboardData.datasets[0].borderColor.push('rgba(54, 162, 235, 1)');
}
} }
}); });