2020-06-23 11:07:47 +02:00
|
|
|
<script lang="typescript">
|
2021-03-21 13:47:52 +01:00
|
|
|
import type { I18n } from "anki/i18n";
|
|
|
|
|
2020-06-23 11:07:47 +02:00
|
|
|
import AxisTicks from "./AxisTicks.svelte";
|
2020-07-06 06:01:49 +02:00
|
|
|
import NoDataOverlay from "./NoDataOverlay.svelte";
|
2021-03-21 10:50:35 +01:00
|
|
|
import CumulativeOverlay from "./CumulativeOverlay.svelte";
|
2021-03-21 10:58:39 +01:00
|
|
|
import HoverColumns from "./HoverColumns.svelte";
|
|
|
|
|
2021-03-21 13:47:52 +01:00
|
|
|
import type { HistogramData } from "./histogram-graph";
|
|
|
|
import { histogramGraph } from "./histogram-graph";
|
|
|
|
import { defaultGraphBounds } from "./graph-helpers";
|
2020-06-23 11:07:47 +02:00
|
|
|
|
|
|
|
export let data: HistogramData | null = null;
|
2020-07-06 06:01:49 +02:00
|
|
|
export let i18n: I18n;
|
2020-06-23 11:07:47 +02:00
|
|
|
|
|
|
|
let bounds = defaultGraphBounds();
|
|
|
|
let svg = null as HTMLElement | SVGElement | null;
|
|
|
|
|
2020-07-06 06:01:49 +02:00
|
|
|
$: histogramGraph(svg as SVGElement, bounds, data);
|
2020-06-23 11:07:47 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<svg bind:this={svg} viewBox={`0 0 ${bounds.width} ${bounds.height}`}>
|
|
|
|
<g class="bars" />
|
2021-03-21 10:58:39 +01:00
|
|
|
<HoverColumns />
|
2021-03-21 10:50:35 +01:00
|
|
|
<CumulativeOverlay />
|
2020-06-23 11:07:47 +02:00
|
|
|
<AxisTicks {bounds} />
|
2020-07-06 06:01:49 +02:00
|
|
|
<NoDataOverlay {bounds} {i18n} />
|
2020-06-23 11:07:47 +02:00
|
|
|
</svg>
|