Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a bug in the text measure logic. The chart tool uses the node-canvas module to measure the width of a text label on server-side. This width is used to determine if a label should be hidden or how much space should be made available for the label.
The bug was that font string that is passed to the canvas context looked like this before
context.font = "100 11 nzz-sans-serif"
. The font string has to follow the same logic as a regular css font string. So it was missing thepx
for the font-size value. This PR fixes that tocontext.font = "100 11px nzz-sans-serif"
. The canvas module couldn't parse this string before and used the default font string which is10 sans-serif
. Which uses a sans-serif font which is installed on the system.This doesn't fully solve the issue of cut off axis labels though. Therefore this PR adds a padding of 4px to the left of the graphic. This fixes all reported cases of cut off axis labels on web and print versions.
Before: https://q.st.nzz.ch/item/340c84efacc301e257fa36acb658f192
After: https://q.st-test.nzz.ch/item/e9046b127bd99afc9cd208b94d18f29c
More item where this problem can be reproduced:
Before: https://q.st-staging.nzz.ch/item/e9046b127bd99afc9cd208b94d1927ce
After: https://q.st-test.nzz.ch/item/e9046b127bd99afc9cd208b94d1925e6
Before: https://q.st-staging.nzz.ch/item/e9046b127bd99afc9cd208b94d1922bf
After: https://q.st-test.nzz.ch/item/e9046b127bd99afc9cd208b94d191357
Before: https://q.st-staging.nzz.ch/item/e9046b127bd99afc9cd208b94d1900bb
After: https://q.st-test.nzz.ch/item/e9046b127bd99afc9cd208b94d190e9d
Basecamp ToDo: https://3.basecamp.com/3500782/buckets/1333707/todos/2273519802