refactor(web): test the live usage column builder (#9993)
This commit is contained in:
1 parent
3bcde91f82
commit
487d1766ca
2 files changed
+10
-26
No files matched your search
@@ -54,7 +54,7 @@ function valueFor(
|
||||
return metric === "tokens" ? entry.totalTokens : entry.costUsd;
|
||||
}
|
||||
|
||||
function buildPeriodColumns(
|
||||
export function buildPeriodColumns(
|
||||
periods: readonly string[],
|
||||
byPeriod: ReadonlyMap<string, DailyTotals | HourlyTotals>,
|
||||
metric: UsageChartMetric,
|
||||
@@ -169,24 +169,6 @@ export function niceScale(peak: number, count: number): { max: number; ticks: re
|
||||
return { max, ticks };
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns the merged daily totals into one column per day.
|
||||
*
|
||||
* Values are absolute, not cumulative: each provider is drawn from the same
|
||||
* zero baseline so the chart never implies that one provider is always larger.
|
||||
*
|
||||
* The chart paths and the hover readout both consume this, so the number under
|
||||
* the cursor is by construction the number that was plotted rather than a
|
||||
* second derivation that can drift from it.
|
||||
*/
|
||||
export function buildDayColumns(
|
||||
days: readonly string[],
|
||||
byDay: ReadonlyMap<string, DailyTotals>,
|
||||
metric: UsageChartMetric,
|
||||
): readonly DayColumn[] {
|
||||
return buildPeriodColumns(days, byDay, metric);
|
||||
}
|
||||
|
||||
export function UsageProviderChart({
|
||||
providers,
|
||||
days,
|
||||
|
||||
Reference in new issue
Block a user