Skip to content
Snippets Groups Projects
Commit eb825ada authored by Darío de la Torre Guinaldo's avatar Darío de la Torre Guinaldo
Browse files

Eventos de cambio de opción funcionan

parent 89dd3189
Branches
No related tags found
No related merge requests found
import { Component, OnInit } from '@angular/core';
import { MatRadioChange } from '@angular/material/radio';
import { MatSelectChange } from '@angular/material/select';
@Component({
selector: 'app-menu-filtros',
......@@ -11,6 +13,45 @@ export class MenuFiltrosComponent implements OnInit {
ngOnInit(): void {
}
seasons: string[] = ['Inversión en I+D (%)', 'Inversión en I+D (Total)', 'Total empleados EJC', 'TotalInvestigadoresEJC'];
opcionSeleccionada: string = this.seasons[0];
opciones: string[] = ['Inversión en I+D (%)', 'Inversión en I+D (Total)', 'Total empleados EJC', 'TotalInvestigadoresEJC'];
opcionSelected: string = this.opciones[0];
yearList: string[] = ['2021','2020','2019'];
yearSelected = this.yearList[0];
comunidadList: string[] = ['Castilla y León','Madrid','Andalucía'];
comunidadSelected = this.comunidadList[0];
cambioOpcion($event: MatRadioChange) {
console.log($event.source.name, $event.value);
this.actualizarDatos();
}
yearChange(change: MatSelectChange) {
console.log(change.value);
this.actualizarDatos();
}
comunidadChange(change: MatSelectChange) {
console.log(change.value);
this.actualizarDatos();
}
actualizarDatos(){
var year = this.yearSelected;
var comunidad = this.comunidadSelected;
var opcion = this.opcionSelected;
this.getDatosCsv(year, comunidad, opcion)
}
async getDatosCsv(year, comunidad, opcion) {
const url = "/assets/total_sectores_"+year+".csv";
const response = await fetch(url);
const datos = await response.text();
console.log(datos);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment