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

234
Vistas
Unable to add ellipsis on first load d3

I don't know why this happens, when I first load my chart the text can't be ellipsised. But after I went to another page and back again, it worked fine. Is there something wrong with my code.

   tickVertical
        .selectAll('text')
        .each(function () {
          // @ts-ignore
          const self = select(this);
          // @ts-ignore
          let textLength = self.node().getComputedTextLength();
          let text = self.text();

          while (textLength > 50 && text.length > 0) {
            text = text.slice(0, -1);
            self.text(text + '...');
            // @ts-ignore
            textLength = self.node().getComputedTextLength();
          }
        })
        .attr('fill', 'white')
        .attr('font-size', '8px')
        .each(function (d: any) {
          select(this).append('title').text(d);
        });

The bug from each method, after I console.log the text and textlength is 0.

enter image description here

about 4 years ago · Juan Pablo Isaza
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