anki/ts/src/stats/EaseGraph.svelte

25 lines
744 B
Svelte
Raw Normal View History

2020-06-23 12:43:19 +02:00
<script lang="typescript">
import { HistogramData } from "./histogram-graph";
import { gatherData, prepareData, GraphData } from "./ease";
import pb from "../backend/proto";
import HistogramGraph from "./HistogramGraph.svelte";
export let sourceData: pb.BackendProto.GraphsOut | null = null;
2020-06-23 12:43:19 +02:00
let svg = null as HTMLElement | SVGElement | null;
let histogramData = null as HistogramData | null;
$: if (sourceData) {
2020-06-23 12:43:19 +02:00
console.log("gathering data");
histogramData = prepareData(gatherData(sourceData));
2020-06-23 12:43:19 +02:00
}
</script>
{#if histogramData}
<div class="graph">
<h1>Card Ease</h1>
<HistogramGraph data={histogramData} xText="Ease (%)" yText="Number of cards" />
</div>
{/if}