1 Commits

Author SHA1 Message Date
Sebastian Seedorf
8b5d4ee6a5 fix: pass config.series_limit to buildSeriesData instead of hardcoded 80 2026-06-05 12:48:47 +02:00
3 changed files with 5 additions and 6 deletions

View File

@@ -50,7 +50,7 @@ export default function SignalsChart({
const { containerRef, legendRef } = usePlot(
(el, w, h, lRef) => {
const data = buildSeriesData(rows, config.signal_type, timeMode);
const data = buildSeriesData(rows, config.signal_type, timeMode, config.series_limit);
if (!data) return null;
const { keys, allXs, data: seriesData } = data;

View File

@@ -1,7 +1,5 @@
import type { SignalRow, ChartConfig, TimeMode } from '@/lib/types';
const MAX_SERIES = 80;
export interface SeriesData {
keys: string[];
allXs: number[];
@@ -12,6 +10,7 @@ export function buildSeriesData(
rows: SignalRow[],
signalType: ChartConfig['signal_type'],
timeMode: TimeMode,
seriesLimit: number = 80,
): SeriesData | null {
const seriesMap = new Map<string, Map<number, number>>();
@@ -34,7 +33,7 @@ export function buildSeriesData(
if (seriesMap.size === 0) return null;
const keys = [...seriesMap.keys()].slice(0, MAX_SERIES);
const keys = [...seriesMap.keys()].slice(0, seriesLimit);
const allXs = [
...new Set(
keys.flatMap((k) => {

View File

@@ -57,11 +57,11 @@ export function usePlot(
// Defer mouseleave — prevents React hydration events firing before lastIdxRef set
requestAnimationFrame(() => {
plot.over.onmouseleave = () => {
plot.over.addEventListener('mouseleave', () => {
const p = plotRef.current;
if (!p) return;
p.setCursor({ left: idxToPixel(p, lastIdxRef.current), top: -10 });
};
});
});
}
// deps is intentionally dynamic — passed by parent to allow external rebuild triggers