2020-06-23 11:07:47 +02:00
|
|
|
<script lang="typescript">
|
2020-11-01 05:26:58 +01:00
|
|
|
import type { HistogramData } from "./histogram-graph";
|
|
|
|
import { histogramGraph } from "./histogram-graph";
|
2020-06-23 11:07:47 +02:00
|
|
|
import AxisTicks from "./AxisTicks.svelte";
|
2020-11-01 05:26:58 +01:00
|
|
|
import { defaultGraphBounds } from "./graph-helpers";
|
2020-07-06 06:01:49 +02:00
|
|
|
import NoDataOverlay from "./NoDataOverlay.svelte";
|
2020-11-05 02:01:30 +01:00
|
|
|
import type { I18n } from "anki/i18n";
|
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" />
|
|
|
|
<g class="hoverzone" />
|
|
|
|
<path class="area" />
|
|
|
|
<AxisTicks {bounds} />
|
2020-07-06 06:01:49 +02:00
|
|
|
<NoDataOverlay {bounds} {i18n} />
|
2020-06-23 11:07:47 +02:00
|
|
|
</svg>
|