fix: dont render graphs on every poll
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user