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";
|
|
|
|
|
2020-06-26 02:42:10 +02:00
|
|
|
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;
|
|
|
|
|
2020-06-26 02:42:10 +02:00
|
|
|
$: if (sourceData) {
|
2020-06-23 12:43:19 +02:00
|
|
|
console.log("gathering data");
|
2020-06-26 02:42:10 +02:00
|
|
|
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}
|