feat: y-axis SI prefix, hide tick from legend, fix table sort

This commit is contained in:
Sebastian Seedorf
2026-06-03 12:52:45 +02:00
parent 8c83e8b8e8
commit 3506d1f6c5
7 changed files with 59 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
import uPlot from 'uplot';
import type { ChartConfig } from '@/lib/types';
import { formatSI } from '@/lib/formatNumber';
// --- Color helpers ---
@@ -164,7 +165,7 @@ export function makeSignalsSeries(
];
}
export function makeSignalsAxes(timeMode: 'real' | 'tick'): uPlot.Axis[] {
export function makeSignalsAxes(timeMode: 'real' | 'tick', locale?: string): uPlot.Axis[] {
return [
{
...AXIS_BASE,
@@ -173,6 +174,10 @@ export function makeSignalsAxes(timeMode: 'real' | 'tick'): uPlot.Axis[] {
vals.map(v => v == null ? '' : new Date(v * 1000).toLocaleTimeString()),
}),
},
{ ...AXIS_BASE },
{
...AXIS_BASE,
values: (_u: uPlot, vals: (number | null)[]) =>
vals.map(v => v == null ? '' : formatSI(v, locale)),
},
];
}