mirror of
https://github.com/pi-hole/web.git
synced 2025-12-20 02:38:28 +00:00
Improve line graph tooltip (#3601)
This commit is contained in:
@@ -518,8 +518,8 @@ function labelWithPercentage(tooltipLabel, skipZero = false) {
|
||||
// Sum all queries for the current time by iterating over all keys in the
|
||||
// current dataset
|
||||
let sum = 0;
|
||||
for (const value of Object.values(tooltipLabel.parsed._stacks.y)) {
|
||||
if (value === undefined) continue;
|
||||
for (const [key, value] of Object.entries(tooltipLabel.parsed._stacks.y)) {
|
||||
if (key.startsWith("_") || value === undefined) continue;
|
||||
const num = Number.parseInt(value, 10);
|
||||
if (num) sum += num;
|
||||
}
|
||||
@@ -636,9 +636,11 @@ $(() => {
|
||||
display: false,
|
||||
},
|
||||
tooltip: {
|
||||
enabled: true,
|
||||
// Disable the on-canvas tooltip
|
||||
enabled: false,
|
||||
intersect: false,
|
||||
yAlign: "bottom",
|
||||
external: customTooltips,
|
||||
yAlign: "top",
|
||||
itemSort(a, b) {
|
||||
return b.datasetIndex - a.datasetIndex;
|
||||
},
|
||||
@@ -653,7 +655,7 @@ $(() => {
|
||||
return "Queries from " + from + " to " + to;
|
||||
},
|
||||
label(tooltipLabel) {
|
||||
return labelWithPercentage(tooltipLabel);
|
||||
return labelWithPercentage(tooltipLabel, true);
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user