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:
parent
ec5c4198d6
commit
44a0030c46
@ -814,6 +814,14 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
callbacks: {
|
callbacks: {
|
||||||
label: function(context) {
|
label: function(context) {
|
||||||
return context.dataset.label + ': ' + fmt(context.parsed.y);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user