-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highcharts and Google Fonts #6782
Comments
Thank you for reporting! |
Hi @pawelfus, Here is a fixed version of the example i sent in my first post. As you will see, I clear the A possible solution would be to include fontFamily in the cacheKey. Here is a link to the source file&line. Another solution could be to make an dedicated method like |
Hi, its me again. Statement in line is the source off this issue. Numbers are not monospaced, at least not for most font families. It makes the renderer treat 10, 20 or 80 labels as same (width and height) but obviuosly that's not the case for non monospaced fonts. Renderer will measure the first two-digit label (in this case its Should I make a PR to fix this issue (basically remove the cachekey alternation with regex)? Would it be helpful for your team? |
Thank you for sharing @nedimg ! Unfortunately it doesn't seem to fix the issue you reported, please take a look: http://jsfiddle.net/zf5z2j1b/ |
Also the first option, of adding |
Any updates on this? Is there a workaround? |
WorkaroundSo there are two problems here: First, the Highcharts bounding box cache is not cleared. Second, the chart is updated before the web fonts are loaded, thereby applying a premature bounding box. It seems like the first problem is fixed by @nedimg's workaround above, white the second one can be fixed by using the Web Font Loader library. See it in action: http://jsfiddle.net/highcharts/9rLpd1y1/7/ |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions! |
Expected behaviour
Text (axis labels, data labels etc), measured and positioned properly after
chart.style.fontFamily
update.Actual behaviour
Chart Y axis labels (probably other labels too) cut off due to fontFamily change. A ugly hack is needed to fix issue...
Live demo with steps to reproduce
JSFiddle
Affected browser(s)
All
The text was updated successfully, but these errors were encountered: