Skip to content
Snippets Groups Projects
Commit 3ce8b887 authored by frajuar's avatar frajuar
Browse files

final

parent 081374e2
No related branches found
No related tags found
No related merge requests found
Pipeline #12913 passed
......@@ -114,16 +114,15 @@ 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;
let textX = centroid[0] + 15;
let textY = centroid[1] - 10;
// 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
if (textY < 10) {
textY = 30; // Mover el texto hacia abajo si está fuera por arriba
}
// Verificar si el texto se sale hacia la parte inferior
if (textY > height - 20) {
if (textY > height - 10) {
textY = height - 40; // Mover el texto hacia arriba si está fuera por abajo
}
......
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