Files
brk/website_next/learn/data/rolling-windows.js
T
2026-06-09 13:35:21 +02:00

21 lines
569 B
JavaScript

import { createCohortSeries } from "./cohort-series.js";
import { colors } from "../../utils/colors.js";
export const rollingWindows = /** @type {const} */ ([
["24h", "_24h", colors.sky],
["1w", "_1w", colors.cyan],
["1m", "_1m", colors.blue],
["1y", "_1y", colors.violet],
]);
/** @param {(key: RollingWindowKey) => ChartMetric} createMetric */
export function createRollingWindowSeries(createMetric) {
return createCohortSeries(
rollingWindows.map(([label, key, color]) => ({
label,
color,
metric: createMetric(key),
})),
);
}