Skip to content
Snippets Groups Projects
Commit 9e2fc8d9 authored by frajuar's avatar frajuar
Browse files

sin prints de debug

parent e00cb604
No related branches found
No related tags found
No related merge requests found
Pipeline #13244 passed
......@@ -13,7 +13,7 @@ document.addEventListener('DOMContentLoaded', function () {
// Convert the value to a number if it's a valid number, otherwise keep it as a string
const value = isNaN(fila[key]) ? fila[key] : parseFloat(fila[key]);
countryData.push(value);
/*console.log(value);*/
}
});
paises.push(countryData);
......@@ -39,7 +39,7 @@ function dibujaSelector(){
// Escuchar cambios en el selector
select.addEventListener("change", function () {
seleccionAnno = select.value; // Actualizar la variable seleccionAnno
/* console.log(seleccionAnno);*/
dibujaMapa(seleccionAnno);
});
}
......@@ -47,7 +47,7 @@ function dibujaSelector(){
function dibujaMapa(seleccionAnno) {
/*console.log(paises);*/
anno=parseInt(seleccionAnno);
let datosAnno=[];
......@@ -55,7 +55,7 @@ function dibujaMapa(seleccionAnno) {
datosAnno.push(paises[i][anno-1959]);
}/**aqui seleccionamos los valores para los paises y el anno seleccionado para poder tener el maximo y el minimo*/
//console.log(datosAnno);
let min=Math.min(...datosAnno.filter(value => value !== 0)); /* minimo y maximo para poder hacer la escala de colores */
let max=Math.max(...datosAnno);
......@@ -92,7 +92,7 @@ function dibujaMapa(seleccionAnno) {
geojson.features.forEach(function (feature) {
const countryName = feature.properties.name;
const index = paises.findIndex(p => p[0] === countryName);
//console.log(`Buscando: ${countryName}, Encontrado en índice: ${index}`);
if (index !== -1) {
// Agregar un valor de datosAnno al GeoJSON
feature.properties.value = datosAnno[index];
......@@ -107,7 +107,7 @@ function dibujaMapa(seleccionAnno) {
.attr("d", path)
.style("fill", function (d) {
const value = d.properties.value;
// console.log(value);
return value === 0 ? "#cce5df" : colores(Math.log(value)); // Colores para países con datos
})
.style("stroke-width", 0.55)
......@@ -218,14 +218,10 @@ function dibujaGrafico(country,paises){
let index;
for(i=0;i<paises.length;i++){
if(paises[i][0]===country){
// console.log(paises[i][0]);
index=i;
//datosPais.push(paises[i]);
}
}
datosPais=paises[index];
console.log(datosPais);
const datos = nombresDeVariables.map((year, i) => ({
Year: parseInt(year),
Valor: typeof datosPais[i + 1] === "number" ? datosPais[i + 1] : null
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment