Fix calculation of tootlip percentage

Signed-off-by: yubiuser <github@yubiuser.dev>
This commit is contained in:
yubiuser
2025-09-10 10:53:24 +02:00
parent 66eb947718
commit 2c1876879d

View File

@@ -521,8 +521,8 @@ function labelWithPercentage(tooltipLabel, skipZero = false) {
// Sum all queries for the current time by iterating over all keys in the // Sum all queries for the current time by iterating over all keys in the
// current dataset // current dataset
let sum = 0; let sum = 0;
for (const value of Object.values(tooltipLabel.parsed._stacks.y)) { for (const [key, value] of Object.entries(tooltipLabel.parsed._stacks.y)) {
if (value === undefined) continue; if (key.startsWith("_") || value === undefined) continue;
const num = Number.parseInt(value, 10); const num = Number.parseInt(value, 10);
if (num) sum += num; if (num) sum += num;
} }