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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DESI_24-25
EvolucionPIB
Commits
65dfee0e
Commit
65dfee0e
authored
11 months ago
by
frajuar
Browse files
Options
Downloads
Patches
Plain Diff
Etiquetas sobre el pais
parent
9da04736
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Js/script.js
+15
-2
15 additions, 2 deletions
Js/script.js
with
15 additions
and
2 deletions
Js/script.js
+
15
−
2
View file @
65dfee0e
...
...
@@ -114,6 +114,19 @@ function dibujaMapa(seleccionAnno) {
.
style
(
"
stroke
"
,
"
black
"
)
.
on
(
"
mouseover
"
,
function
(
event
,
d
){
const
centroid
=
path
.
centroid
(
d
);
let
textX
=
centroid
[
0
]
+
(
Math
.
random
()
*
20
-
10
);
// Aleatorizar un poco
let
textY
=
centroid
[
1
]
-
20
;
// Verificar si el texto se sale hacia la parte superior
if
(
textY
<
0
)
{
textY
=
20
;
// Mover el texto hacia abajo si está fuera por arriba
}
// Verificar si el texto se sale hacia la parte inferior
if
(
textY
>
height
-
20
)
{
textY
=
height
-
40
;
// Mover el texto hacia arriba si está fuera por abajo
}
d3
.
select
(
this
)
.
raise
()
.
style
(
"
cursor
"
,
"
pointer
"
)
...
...
@@ -124,8 +137,8 @@ function dibujaMapa(seleccionAnno) {
translate(
${
-
centroid
[
0
]}
,
${
-
centroid
[
1
]}
)`
);
const
textElement
=
svg
.
append
(
"
text
"
)
.
attr
(
"
id
"
,
"
texto
"
)
.
attr
(
"
x
"
,
centroid
[
0
]
+
20
)
.
attr
(
"
y
"
,
centroid
[
1
]
-
20
)
.
attr
(
"
x
"
,
textX
)
.
attr
(
"
y
"
,
textY
-
5
)
.
style
(
"
font-family
"
,
"
Arial
"
)
.
style
(
"
fill
"
,
"
black
"
)
.
text
(
`
${
d
.
properties
.
name
}
:
${
d
.
properties
.
value
?
d
.
properties
.
value
.
toFixed
(
2
)
:
'
Sin datos
'
}
`
)
...
...
...
...
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
sign in
to comment