From 7e6ba2f73a5116d3e3a17c0b23fa97fcddf9dd9c Mon Sep 17 00:00:00 2001 From: Martin Araneda Date: Wed, 15 Feb 2023 15:31:17 -0300 Subject: [PATCH] Chart dropdown finished --- frontend/src/views/Chart.vue | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/Chart.vue b/frontend/src/views/Chart.vue index bbf7628..9f1a86a 100644 --- a/frontend/src/views/Chart.vue +++ b/frontend/src/views/Chart.vue @@ -13,6 +13,8 @@ let textColorSecondary = documentStyle.getPropertyValue('--text-color-secondary' let surfaceBorder = documentStyle.getPropertyValue('--surface-border'); const time_elapsed = ref([]); const coins = ref([]); +const games = ref([]); +const selectedGames = ref(); const lineData = ref(null); const lineOptions = ref(null); @@ -23,9 +25,29 @@ const setColorOptions = () => { textColorSecondary = documentStyle.getPropertyValue('--text-color-secondary'); surfaceBorder = documentStyle.getPropertyValue('--surface-border'); }; + +const probando = () => { + console.log(selectedGames.value) +} + +async function getGames() { + try { + const response = await axios.get(`http://localhost:3001/game?limit=5000`); + games.value = response.data.map(game_id => { + return game_id.ID; + }); + } + catch (error) { + console.error(error); + } +} + async function setChart() { try { - const response = await axios.get(`http://localhost:3001/frame?limit=5000&game_id=4`); + if (selectedGames.value === undefined) { + return; + } + const response = await axios.get(`http://localhost:3001/frame?limit=5000&game_id=` + selectedGames.value); time_elapsed.value = response.data.map(frame => { return Math.floor(frame.elapsed_time / 1000); }); @@ -104,6 +126,7 @@ watch( onMounted(() => { checkAuth(); setChart(); + getGames(); }) const checkAuth = () => { @@ -116,6 +139,8 @@ const checkAuth = () => {
+