This commit is contained in:
Mateusz Gruszczyński committed 2026-11-08 21:11:33 +01:00
1 parent e7143151bd
commit 213332d0b5
4 files changed
+10 -33

No files matched your search

+3 -3
View File
@@ -408,7 +408,7 @@ function cacheOutcomeMix(totals) {
return { counts, percentages: counts.map(value => value / requests * 100), requests };
}
// Percent labels live inside the bar segments; a label that does not fit is hidden
// (the legend below always carries the exact value).
// (the exact count and percentage stay in the segment and legend tooltips).
function fitCacheMixLabels() {
const bar = $("cache-mix-bar");
if (!bar) return;
@@ -429,8 +429,8 @@ function renderCacheMix(mix, totalRequests) {
const segment = $(`cache-mix-${name}`);
segment.style.width = `${pct}%`;
segment.textContent = mix && pct > 0 ? `${fmt(pct, pct < 10 ? 1 : 0)}%` : "";
$(`cache-mix-${name}-count`).textContent = mix ? fmt(mix.counts[i]) : "-";
$(`cache-mix-${name}-percent`).textContent = mix ? `${fmt(pct, 1)}%` : "-";
const detail = mix ? `${name.toUpperCase()}: ${fmt(mix.counts[i])} (${fmt(pct, 1)}%)` : "";
segment.title = detail; $(`cache-mix-${name}-key`).title = detail;
});
fitCacheMixLabels();
$("cache-mix-headline").textContent = mix ? `${fmt(mix.percentages[0], 1)}% HIT` : "-";