Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Parsing error in excanvas tick labels' fontsize if the font size is not numeric #991

Closed
daniel-rothig opened this Issue Mar 13, 2013 · 1 comment

Comments

Projects
None yet
2 participants

When the formatting for tick labels is evaluated, you generate a div element and query its css properties. The line:

parseInt(element.css("font-size"), 10)

evaluates to NaN if the font-size is not numerical (eg. "smaller"), as I've reproduced in IE8. This then leads to a malformed font description string, causing the plot to fail. For my own purposes, I hacked in a workaround

parseInt(element.css("font-size"), 10) || 11

Unfortunately it seems that jQuery doesn't have a way to always retrieve font size in pixels, so some clever workaround may be required:
https://forum.jquery.com/topic/jquery-how-to-get-font-size-in-pixels

@ghost ghost assigned dnschnur Mar 13, 2013

Owner

dnschnur commented Mar 13, 2013

Good catch; we need to get this fixed ASAP. Thanks very much for reporting this!

dnschnur added a commit that referenced this issue Mar 14, 2013

Temporary patch for font-size parsing issue.
This partially addresses #991, but a more complete solution, or better
documentation, is still necessary.

@dnschnur dnschnur closed this in a1b4afc Mar 31, 2013

dnschnur added a commit to dnschnur/flot that referenced this issue Apr 6, 2013

Temporary patch for font-size parsing issue.
This partially addresses #991, but a more complete solution, or better
documentation, is still necessary.

dnschnur added a commit to dnschnur/flot that referenced this issue Apr 6, 2013

A better fix for the font-size 'smaller' problem.
This resolves #991, replacing the earlier temporary patch.  It takes
advantage of the fact that line-height can take the form of a unit-less
integer, in which case it mirrors the font-size, even when it is
something abstract, like 'smaller'.  We can then read the dummy
element's height to learn the effective font-size.

@dreckard dreckard referenced this issue in markrcote/flot-tickrotor Feb 11, 2015

Open

Default Font Fails with excanvas #15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment