second pass. low
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import * as Plot from '@observablehq/plot';
|
||||
import { onMount } from 'svelte';
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
import type { Timeseries, AthleteZones } from '../lib/types';
|
||||
|
||||
export let timeseries: Timeseries;
|
||||
@@ -82,8 +82,15 @@
|
||||
// Range handles — reset whenever the metric or chart type changes
|
||||
let trimMin = 0;
|
||||
let trimMax = 100;
|
||||
$: if (dataMin !== undefined) resetTrim(dataMin, dataMax);
|
||||
function resetTrim(lo: number, hi: number) { trimMin = lo; trimMax = hi; }
|
||||
let lastResetTab: Tab | null = null;
|
||||
$: {
|
||||
// Reset trim on tab change OR when data range changes
|
||||
if (activeTab !== lastResetTab || trimMin < dataMin || trimMax > dataMax) {
|
||||
trimMin = dataMin;
|
||||
trimMax = dataMax;
|
||||
lastResetTab = activeTab;
|
||||
}
|
||||
}
|
||||
|
||||
$: step = (dataMax - dataMin) / 200 || 1;
|
||||
|
||||
@@ -116,6 +123,7 @@
|
||||
|
||||
// ── Rendering ────────────────────────────────────────────────────────────
|
||||
onMount(() => { renderChart(); });
|
||||
onDestroy(() => { chart?.remove(); chart = null; });
|
||||
|
||||
$: if (chartEl) {
|
||||
activeTab; xMode; chartType; histData; histThresholds; alignZones;
|
||||
|
||||
Reference in New Issue
Block a user