Ensure percentages are computed correctly

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2024-02-12 16:08:05 +01:00
parent 50f28e8a93
commit c64d84a18f
+5 -2
View File
@@ -532,9 +532,12 @@ $(function () {
},
label: function (tooltipLabel) {
var label = tooltipLabel.dataset.label;
// Sum all queries for the current time
// Sum all queries for the current time by iterating over all keys
// in the current dataset
let sum = 0;
for (let i = 0; i < tooltipLabel.parsed._stacks.y._top; i++) {
const keys = Object.keys(tooltipLabel.parsed._stacks.y);
for (let i = 0; i < keys.length; i++) {
if (tooltipLabel.parsed._stacks.y[i] === undefined) continue;
sum += parseInt(tooltipLabel.parsed._stacks.y[i], 10);
}