2020-06-23 12:43:19 +02:00
|
|
|
<script lang="typescript">
|
2020-11-01 05:26:58 +01:00
|
|
|
import type { HistogramData } from "./histogram-graph";
|
2020-07-22 06:11:22 +02:00
|
|
|
import { gatherData, prepareData } from "./ease";
|
2020-11-05 02:01:30 +01:00
|
|
|
import type pb from "anki/backend_proto";
|
2020-06-23 12:43:19 +02:00
|
|
|
import HistogramGraph from "./HistogramGraph.svelte";
|
2020-11-05 02:01:30 +01:00
|
|
|
import type { I18n } from "anki/i18n";
|
2020-11-01 05:26:58 +01:00
|
|
|
import type { TableDatum } from "./graph-helpers";
|
2020-08-21 04:58:02 +02:00
|
|
|
import TableData from "./TableData.svelte";
|
2020-06-23 12:43:19 +02:00
|
|
|
|
2020-06-26 02:42:10 +02:00
|
|
|
export let sourceData: pb.BackendProto.GraphsOut | null = null;
|
2020-06-28 06:21:31 +02:00
|
|
|
export let i18n: I18n;
|
2020-06-23 12:43:19 +02:00
|
|
|
|
|
|
|
let histogramData = null as HistogramData | null;
|
2020-08-21 04:58:02 +02:00
|
|
|
let tableData: TableDatum[] = [];
|
2020-06-23 12:43:19 +02:00
|
|
|
|
2020-06-26 02:42:10 +02:00
|
|
|
$: if (sourceData) {
|
2020-08-21 04:58:02 +02:00
|
|
|
[histogramData, tableData] = prepareData(gatherData(sourceData), i18n);
|
2020-06-23 12:43:19 +02:00
|
|
|
}
|
2020-06-28 06:21:31 +02:00
|
|
|
|
|
|
|
const title = i18n.tr(i18n.TR.STATISTICS_CARD_EASE_TITLE);
|
2020-06-28 12:52:38 +02:00
|
|
|
const subtitle = i18n.tr(i18n.TR.STATISTICS_CARD_EASE_SUBTITLE);
|
2020-06-23 12:43:19 +02:00
|
|
|
</script>
|
|
|
|
|
2020-07-16 20:44:21 +02:00
|
|
|
<div class="graph" id="graph-ease">
|
2020-07-06 06:01:49 +02:00
|
|
|
<h1>{title}</h1>
|
2020-06-23 12:43:19 +02:00
|
|
|
|
2020-07-06 06:01:49 +02:00
|
|
|
<div class="subtitle">{subtitle}</div>
|
2020-06-28 09:44:51 +02:00
|
|
|
|
2020-07-06 06:01:49 +02:00
|
|
|
<HistogramGraph data={histogramData} {i18n} />
|
2020-08-21 04:58:02 +02:00
|
|
|
|
|
|
|
<TableData {i18n} {tableData} />
|
2020-07-06 06:01:49 +02:00
|
|
|
</div>
|