export const DEFAULT_TREND_PRESET = "1"; export const DEFAULT_MAX_TREND_SERIES = 10; export const MAX_TREND_SERIES = 100; export const DEFAULT_TREND_ROWS = 20_000; export const MIN_TREND_ROWS = 100; export const MAX_TREND_ROWS = 50_000; const MAX_TREND_SAMPLES = 250_000; export function maxTrendRowsForSeries(seriesCount) { return Math.min(MAX_TREND_ROWS, Math.floor(MAX_TREND_SAMPLES / Math.max(1, seriesCount || 1))); } export const TREND_PRESETS = [ { value: "0.0034722222", label: "5 min" }, { value: "0.0069444444", label: "10 min" }, { value: "0.0208333333", label: "30 min" }, { value: "0.0416666667", label: "1 h" }, { value: "0.0833333333", label: "2 h" }, { value: "0.25", label: "6 h" }, { value: "0.5", label: "12 h" }, { value: "1", label: "24 h" }, { value: "2", label: "2 Tage" }, { value: "3", label: "3 Tage" }, { value: "7", label: "7 Tage" }, { value: "14", label: "14 Tage" }, { value: "30", label: "30 Tage" }, ]; export function normalizeMaxTrendSeries(value, fallback = DEFAULT_MAX_TREND_SERIES) { const count = Number(value); return Number.isInteger(count) && count >= 1 && count <= MAX_TREND_SERIES ? count : fallback; }