mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Modified dashboard tooltips to add percentage as well as count
This commit is contained in:
parent
78580136f6
commit
0424308863
|
@ -431,7 +431,13 @@
|
|||
tooltips: {
|
||||
callbacks: {
|
||||
label: function(tooltipItem, data) {
|
||||
return data.labels[tooltipItem.datasetIndex] || '';
|
||||
counts = data.datasets[0].data;
|
||||
total = 0;
|
||||
for(var i in counts) {
|
||||
total += counts[i];
|
||||
}
|
||||
prefix = data.labels[tooltipItem.index] || '';
|
||||
return prefix+" "+Math.round(counts[tooltipItem.index]/total*100)+"%";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue