Skip to content

Commit

Permalink
history output selectable by button
Browse files Browse the repository at this point in the history
  • Loading branch information
maldestor95 committed Jan 17, 2024
1 parent f74695f commit a2a1119
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
16 changes: 13 additions & 3 deletions src/pages/wizard/history.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<template>
<div>History</div>
<container class="grid grid-cols-[56px_1fr] overflow-y-auto max-h-[300px]">
<div class="flex flex-row justify-center gap-2">
<button @click="setGraph = 'total'">Total</button>
<button @click="setGraph = 'table'">Table</button>
<button @click="setGraph = 'cumulative'">cumulative</button>
</div>
<container
class="grid grid-cols-[56px_1fr] overflow-y-auto max-h-[300px]"
v-if="setGraph == 'table'"
>
<div class="font-semibold">
<div class="firstLine">Round</div>
<div v-for="(item, index) in store.getRoundNumber" :key="index">
Expand All @@ -18,14 +26,16 @@
</div>
</div>
</container>
<historychart></historychart>
<historychart :graph-type="<graphType><unknown>setGraph"></historychart>
</template>

<script setup lang="ts">
import { useScoreStore } from "./store";
import container from "../../components/container.vue";
import historychart from "./historychart.vue";
import historychart, { Props as graphType } from "./historychart.vue";
import { ref } from "vue";
const setGraph = ref<"total" | "cumulative" | "table" | undefined>("total");
const store = useScoreStore();
</script>

Expand Down
17 changes: 9 additions & 8 deletions src/pages/wizard/historychart.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
<template>
<div>Chart</div>
<div class="flex flex-row justify-center gap-2">
<button @click="setGraph = 'total'">Total</button>
<button @click="setGraph = 'cumulative'">cumulative</button>
</div>

<Bar
:data="myDataTotal.data"
:options="myDataTotal.options"
v-if="setGraph == 'total'"
v-if="props.graphType == 'total'"
/>
<Line
:data="myDataCumulative.data"
:options="myDataCumulative.options"
v-if="setGraph == 'cumulative'"
v-if="props.graphType == 'cumulative'"
/>
{{ store.getScore(1) }}
</template>
Expand All @@ -33,9 +30,13 @@ import {
import zoomPlugin from "chartjs-plugin-zoom";
import { Bar, Line } from "vue-chartjs";
import { useScoreStore } from "./store";
import { ref } from "vue";
const setGraph = ref("cumulative");
export type Props = {
graphType: "total" | "cumulative" | undefined;
};
const props = withDefaults(defineProps<Props>(), {
graphType: "total",
});
const store = useScoreStore();
Expand Down

0 comments on commit a2a1119

Please sign in to comment.