Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

134
Vistas
D3 - Can't get popover to appear at cursor xy coordinate

I'm trying to get nodes to show an adjacent popover when clicked. Here's a codepen on where I'm at: https://codepen.io/SavanaPope/pen/abLdmbz?editors=1000

I've gotten very close, the popover currently shows in the upper-left corner, and is taking in on-click x/y data. It's just not getting the correct cursor location - I'm not sure how it's getting the pixel data currently.

I assume the issue has something to do with the clicknode function:

function clicknode(nodes) {
  const[x, y] = d3.pointer(event);
  tooltip.style("left", (x)+"px")
         .style("top", (y)+"px")
         .transition().duration(200).style("opacity", 0.9)

  loadTooltipContent(nodes);
}

But I just can't figure out where my (likely) formatting is wrong.

If you have any ideas on how to solve this, I'd really appreciate it.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

For D3 V7, rewrite clicknode as follows:

function clicknode(event, nodes) {
  tooltip
    .style("left", `${event.layerX}px`)
    .style("top", `${event.layerY}px`);
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda