fix: dont render graphs on every poll

This commit is contained in:
2026-10-06 21:01:37 +02:00
parent e151ab4f26
commit 98a71e3114
17 changed files with 783 additions and 659 deletions
+9
View File
@@ -1,3 +1,4 @@
import { CHANNEL_COLORS } from '../../constants';
import { CurvePoint, CurveStyle, Curve, DEFAULT_CURVE_COLORS, sumCurvePoints } from './curve';
export { sumCurvePoints };
@@ -96,3 +97,11 @@ export function drawCurves({ ctx, toPx, xMin, xMax, yMin, yMax, curves }: DrawCu
drawSingleCurve(ctx, toPx, curve.points, xMin, xMax, yMin, yMax, style);
}
}
export function buildColorMap<T extends string>(channels: T[]): Record<T, string> {
const map = {} as Record<T, string>;
channels.forEach((ch, i) => {
map[ch] = CHANNEL_COLORS[i % CHANNEL_COLORS.length];
});
return map;
}