Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

224
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!