diff --git a/src/App.svelte b/src/App.svelte index 6d7ca7d..1017a0e 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -31,7 +31,7 @@ // reset active datasets to fluview -> ili $activeDatasets = [ds.datasets[1]]; if (chart) { - chart.fitData(true, [ds.datasets[1]]); + chart.fitData(true, ds.datasets[1]); } } }); @@ -39,7 +39,7 @@ - + import { onMount } from 'svelte'; import type DataSet from '../data/DataSet'; + import type DataGroup from '../data/DataSet'; import { DEFAULT_VIEWPORT } from '../data/DataSet'; import EpiDate from '../data/EpiDate'; import { Align, contains, isTouchEvent, NavMode, zeroPad } from './chartUtils'; @@ -380,7 +381,11 @@ return { x: x + dx, y: y + dy - h, w: w, h: h }; } - export function fitData(shouldAnimate = false, extras: DataSet[] = []): void { + export function fitData( + shouldAnimate = false, + include: DataSet | DataGroup | null = null, + exclude: DataSet | DataGroup | null = null, + ): void { if (datasets.length === 0) { return; } @@ -389,7 +394,14 @@ let _xMax = temp[temp.length - 1].getDate().getIndex() + 0.5; let _yMin = datasets[0].getPointValue(0); let _yMax = _yMin; - let dss = [...datasets, ...extras]; + let dss = null; + if (include) { + dss = [...datasets, include]; + } else if (exclude) { + dss = datasets.filter((d) => d !== exclude); + } else { + dss = datasets; + } for (const ds of dss) { const data = ds.data; _xMin = Math.min(_xMin, data[0].getDate().getIndex() - 0.5); diff --git a/src/components/LeftMenu.svelte b/src/components/LeftMenu.svelte index 80059d9..a4e5652 100644 --- a/src/components/LeftMenu.svelte +++ b/src/components/LeftMenu.svelte @@ -1,11 +1,13 @@ @@ -13,9 +15,9 @@
{#each $datasetTree.datasets as child (child.title)} {#if child instanceof DataSet} - + {:else} - + {/if} {/each}
diff --git a/src/components/tree/TreeInnerNode.svelte b/src/components/tree/TreeInnerNode.svelte index 4044d61..82a5a4d 100644 --- a/src/components/tree/TreeInnerNode.svelte +++ b/src/components/tree/TreeInnerNode.svelte @@ -1,12 +1,14 @@