Show monthly total in project chart tooltip

When hovering over a bar in the Cost by Project chart, the tooltip
now shows the total for that month across all projects at the bottom.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Konrad du Plessis 2026-03-05 17:32:14 +02:00
parent ec5c4198d6
commit 44a0030c46

View File

@ -814,6 +814,14 @@ document.addEventListener('DOMContentLoaded', function() {
callbacks: {
label: function(context) {
return context.dataset.label + ': ' + fmt(context.parsed.y);
},
// Show the month total at the bottom of the tooltip
footer: function(tooltipItems) {
var total = 0;
tooltipItems[0].chart.data.datasets.forEach(function(ds) {
total += ds.data[tooltipItems[0].dataIndex] || 0;
});
return 'Total: ' + fmt(total);
}
}
}