c039845c16
This allows for tree shaking, and reduces the congrats page from 150k with the old enum solution to about 80k.
27 lines
881 B
Svelte
27 lines
881 B
Svelte
<script lang="typescript">
|
|
import AxisTicks from "./AxisTicks.svelte";
|
|
import NoDataOverlay from "./NoDataOverlay.svelte";
|
|
import CumulativeOverlay from "./CumulativeOverlay.svelte";
|
|
import HoverColumns from "./HoverColumns.svelte";
|
|
|
|
import type { HistogramData } from "./histogram-graph";
|
|
import { histogramGraph } from "./histogram-graph";
|
|
import { defaultGraphBounds } from "./graph-helpers";
|
|
|
|
export let data: HistogramData | null = null;
|
|
import * as tr from "anki/i18n";
|
|
|
|
let bounds = defaultGraphBounds();
|
|
let svg = null as HTMLElement | SVGElement | null;
|
|
|
|
$: histogramGraph(svg as SVGElement, bounds, data);
|
|
</script>
|
|
|
|
<svg bind:this={svg} viewBox={`0 0 ${bounds.width} ${bounds.height}`}>
|
|
<g class="bars" />
|
|
<HoverColumns />
|
|
<CumulativeOverlay />
|
|
<AxisTicks {bounds} />
|
|
<NoDataOverlay {bounds} />
|
|
</svg>
|