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 4 additions and 5 deletions

View File

@@ -50,7 +50,7 @@ export default function SignalsChart({
const { containerRef, legendRef } = usePlot( const { containerRef, legendRef } = usePlot(
(el, w, h, lRef) => { (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; if (!data) return null;
const { keys, allXs, data: seriesData } = data; const { keys, allXs, data: seriesData } = data;

View File

@@ -42,7 +42,7 @@ export default function TableViz({ config, rows, onEdit, onDelete }: Props) {
<th className="text-right px-2 py-1 text-green-400">Green</th> <th className="text-right px-2 py-1 text-green-400">Green</th>
)} )}
{config.signal_type !== 'green' && ( {config.signal_type !== 'green' && (
<th className="text-right px-2 py-1 text-red-400">Red</th> <th className="text-right px-2 py-1 text-red-400">Red (NP)</th>
)} )}
</tr> </tr>
</thead> </thead>

View File

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