fix: Update tooltip callback to display correct data

This commit is contained in:
Paul Gauthier (aider) 2024-08-13 13:52:56 -07:00
parent a7b108a0e9
commit b38b92dbbc

View file

@ -44,7 +44,10 @@ document.addEventListener('DOMContentLoaded', function () {
tooltip: {
callbacks: {
label: function(context) {
return `${context.raw.label}: ${Math.round(context.raw.percentage)}% (${context.raw.lines} lines)`;
var label = context.dataset.label || '';
var value = context.parsed.y || 0;
var lines = context.raw || 0;
return `${label}: ${Math.round(value)}% (${lines} lines)`;
}
}
},