global: big snapshot

This commit is contained in:
nym21
2026-04-13 22:46:56 +02:00
parent c3cef71aa3
commit 765261648d
89 changed files with 4138 additions and 149 deletions
+54
View File
@@ -1099,6 +1099,60 @@ export function chartsFromCount({ pattern, title = (s) => s, metric, unit, color
});
}
/**
* Percent + ratio per rolling window + cumulative — mirrors chartsFromCount for percent data.
* @param {Object} args
* @param {PercentRatioCumulativePattern} args.pattern
* @param {(metric: string) => string} [args.title]
* @param {string} args.metric
* @param {Color} [args.color]
* @returns {PartialOptionsTree}
*/
export function chartsFromPercentCumulative({
pattern,
title = (s) => s,
metric,
color,
}) {
return [
{
name: "Compare",
title: title(metric),
bottom: ROLLING_WINDOWS.flatMap((w) =>
percentRatio({
pattern: pattern[w.key],
name: w.name,
color: w.color,
}),
).concat(
percentRatio({
pattern: pattern.cumulative,
name: "All Time",
color: colors.time.all,
}),
),
},
...ROLLING_WINDOWS.map((w) => ({
name: w.name,
title: title(`${w.title} ${metric}`),
bottom: percentRatio({
pattern: pattern[w.key],
name: w.name,
color: color ?? w.color,
}),
})),
{
name: "Cumulative",
title: title(`Cumulative ${metric}`),
bottom: percentRatio({
pattern: pattern.cumulative,
name: "All Time",
color: color ?? colors.time.all,
}),
},
];
}
/**
* Windowed sums + cumulative for multiple named entries (e.g. transaction versions)
* @param {Object} args