Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EvolucionPIB
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DESI_24-25
EvolucionPIB
Commits
9e2fc8d9
Commit
9e2fc8d9
authored
3 months ago
by
frajuar
Browse files
Options
Downloads
Patches
Plain Diff
sin prints de debug
parent
e00cb604
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#13244
passed
3 months ago
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Js/script.js
+6
-10
6 additions, 10 deletions
Js/script.js
with
6 additions
and
10 deletions
Js/script.js
+
6
−
10
View file @
9e2fc8d9
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment