7d8f19e6e4
- The previous commits moved the majority of the remaining global css into components; move the remaining @emotion/css references into ticks.scss and the styling of the Graph.svelte. This is not as elegant as the emotion solution, but builds a whole lot faster, and most of our styling can be scoped to a component anyway. - Leave the .html files in ts/ for now. AnkiMobile uses them, and AnkiDroid likely will in the future too. In the long run we'll likely move to loading the JS into an existing page instead of loading a separate page, but at that point we can just exclude the .html file from copy_files_into_group() without affecting other clients. Closes #1074
29 lines
922 B
Svelte
29 lines
922 B
Svelte
<script lang="typescript">
|
|
import type { I18n } from "anki/i18n";
|
|
|
|
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;
|
|
export let i18n: 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} {i18n} />
|
|
</svg>
|