feat: Create stacked bar chart for lines of code by author

This commit is contained in:
Paul Gauthier (aider) 2024-12-26 19:50:21 -04:00
parent 5c3cca157d
commit 07b96bef95

View file

@ -24,8 +24,15 @@ document.addEventListener('DOMContentLoaded', function () {
var linesData = { var linesData = {
labels: labels, labels: labels,
datasets: [{ datasets: [{
label: 'Aider\'s lines of new code', label: 'Lines by aider',
data: [{% for row in site.data.blame %}{ x: '{{ row.end_tag }}', y: {{ row.aider_total }} },{% endfor %}], data: [{% for row in site.data.blame %}{ x: '{{ row.end_tag }}', y: {{ row.aider_total }} },{% endfor %}],
backgroundColor: 'rgba(54, 162, 235, 0.8)',
borderColor: 'rgba(54, 162, 235, 1)',
borderWidth: 1
},
{
label: 'Lines by human',
data: [{% for row in site.data.blame %}{ x: '{{ row.end_tag }}', y: {{ row.total_lines - row.aider_total }} },{% endfor %}],
backgroundColor: 'rgba(255, 99, 132, 0.8)', backgroundColor: 'rgba(255, 99, 132, 0.8)',
borderColor: 'rgba(255, 99, 132, 1)', borderColor: 'rgba(255, 99, 132, 1)',
borderWidth: 1 borderWidth: 1
@ -98,6 +105,7 @@ document.addEventListener('DOMContentLoaded', function () {
} }
}, },
y: { y: {
stacked: true,
title: { title: {
display: true, display: true,
text: 'Lines of new code' text: 'Lines of new code'
@ -107,12 +115,12 @@ document.addEventListener('DOMContentLoaded', function () {
}, },
plugins: { plugins: {
legend: { legend: {
display: false display: true
}, },
tooltip: { tooltip: {
callbacks: { callbacks: {
label: function(context) { label: function(context) {
var label = 'New lines of code by aider'; var label = context.dataset.label;
var value = context.parsed.y || 0; var value = context.parsed.y || 0;
return `${label}: ${value}`; return `${label}: ${value}`;
} }
@ -120,7 +128,7 @@ document.addEventListener('DOMContentLoaded', function () {
}, },
title: { title: {
display: true, display: true,
text: 'Lines of new code written by aider, by release', text: 'Lines of new code by author, by release',
font: { font: {
size: 16 size: 16
} }