Skip to content

Commit

Permalink
visual completa
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoRedondoo committed Apr 20, 2024
1 parent 1e9c4b3 commit d533193
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions front/src/routes/ufc-events-data/graph/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
<script>
import { onMount } from "svelte";
import { Container, Button, Row, Col } from '@sveltestrap/sveltestrap';
import { dev } from "$app/environment";
// import Highcharts from 'highcharts/highstock';
let DATAAPI = "http://localhost:10002/data";
let API = "/api/v2/ufc-events-data";
if(dev)
API = "http://localhost:10002" + API;
async function getData() {
try {
const res = await fetch(DATAAPI);
const res = await fetch(API);
const dataJSON = await res.json();
console.log(`fetched data: ${dataJSON}`)
fillChart(dataJSON);
Expand All @@ -22,16 +25,16 @@
console.log(`error => ${error}`)
}
}
async function getDataPie(){
try {
const res = await fetch(DATAAPI);
const dataJSON = await res.json();
console.log(`fetched data: ${dataJSON}`)
fillPieChart(dataJSON);
} catch (error) {
console.error('Error al obtener datos para el gráfico de tarta:', error);
}
}
// async function getDataPie(){
// try {
// const res = await fetch(DATAAPI);
// const dataJSON = await res.json();
// console.log(`fetched data: ${dataJSON}`)
// fillPieChart(dataJSON);
// } catch (error) {
// console.error('Error al obtener datos para el gráfico de tarta:', error);
// }
// }
async function fillChart(dt) {
Expand Down Expand Up @@ -186,10 +189,11 @@
})
</script>

<Container>
<Row class="justify-content-center">
<div id="container" style="width:100%; height:400px;"></div>
<div id="pie-container" style="width:100%; height:400px;"></div>
<Col xs="auto">Volver -> <Button href="/ufc-events-data" outline size="sm" color="danger">Volver</Button></Col>
</Row>
</Container>

0 comments on commit d533193

Please sign in to comment.