Giter Club home page Giter Club logo

Comments (8)

geohuz avatar geohuz commented on July 23, 2024
   var data = [{text: 'Pellentesque habitant morbi tristiqu'}]
    new d3plus.TextBox()
      .data(data)
      .fontSize(17)
      .width(50)
      .render();

I got the d3plus-text.full.js:3174 Uncaught TypeError: Cannot read property 'replace' of undefined,
further testing shows that sometimes the text element doesn't render at all, sometimes throw errors. I tried adjusting fontsize, width, height, and overflow options. The behavior is unpredictable.

from d3plus-text.

davelandry avatar davelandry commented on July 23, 2024

Good find. I've pushed a fix.

The reason text sometimes does not render, as in your case, is because the first word of your sentence cannot fit given the specified fontSize and width.

from d3plus-text.

geohuz avatar geohuz commented on July 23, 2024

@davelandry , thanks for the fix! Now I can confirm the error is gone, but I still see it renders nothing, when it is supposed to render ellipsis, in case of there is no enough room for rendering text in a single line.

from d3plus-text.

davelandry avatar davelandry commented on July 23, 2024

You're right, it should render an ellipsis in this case. I'll push that fix as well.

from d3plus-text.

davelandry avatar davelandry commented on July 23, 2024

@geohuz just pushed some tweaks to the logic, what do you think?

from d3plus-text.

geohuz avatar geohuz commented on July 23, 2024

Yeah! it works now!

from d3plus-text.

geohuz avatar geohuz commented on July 23, 2024

I got another issue with the long text rendering, and suspected that's related to this ticket, the rendering text is: "建立客户信息反馈机制,跟踪解决过程,问题解决率达到80%以上", throwing the following error:

d3plus-text.js:210 Uncaught TypeError: Cannot read property 'trimRight' of undefined

I'm using the version 0.9.8

from d3plus-text.

davelandry avatar davelandry commented on July 23, 2024

That string is rendering an ellipsis for me, and not throwing any errors. Can you please post your full TextBox config or a jsfiddle?

from d3plus-text.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.