Skip to content
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

fix(canvas_text_bbox_calculator): increase font scaling factor #93

Merged
merged 5 commits into from
Mar 8, 2019

Conversation

emmacunningham
Copy link
Contributor

@emmacunningham emmacunningham commented Mar 7, 2019

Summary

close #90

This PR fixes the truncation issues with formatted labels on Chrome by adding a 1px padding amount to cover any undercalculation. This also means that we can now significantly reduce the amount that we are scaling fonts by. It does not completely remove the need for a bit of scaling (tested just with offsetting with padding and there was still some truncation).

On Mac OS X Chrome:
image

Also, see #94 for enhancing this by allowing users to define more padding.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

  • This was checked for cross-browser compatibility, including a check against IE11
    - [ ] Proper documentation or storybook story was added for features that require explanation or tutorials
    - [ ] Unit tests were updated or added to match the most common scenarios
  • Each commit follows the convention

@codecov-io
Copy link

codecov-io commented Mar 7, 2019

Codecov Report

Merging #93 into master will increase coverage by 0.44%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #93      +/-   ##
==========================================
+ Coverage   88.07%   88.51%   +0.44%     
==========================================
  Files          28       28              
  Lines        1132     1132              
  Branches      118      118              
==========================================
+ Hits          997     1002       +5     
+ Misses        125      120       -5     
  Partials       10       10
Impacted Files Coverage Δ
src/lib/axes/canvas_text_bbox_calculator.ts 100% <100%> (+31.25%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dcee68e...51b385d. Read the comment docs.

@emmacunningham
Copy link
Contributor Author

@markov00 Codecov was blocking merge because we didn't have any tests written for canvas_text_bbox_calculator, so I went to write those tests to get this through, but then it turned out to be a bit more involved since we needed to add support for mocking canvas in our jest tests for all of the functionality to be tested :) Let me know if you prefer to have the updated tests in a different PR and keep this one just focused on the fixes for the text truncation and I can move these commits to another PR.

Copy link
Member

@markov00 markov00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, Code looks good to me and tested locally on chrome works fine.
I've also see that you already added the canvas mock and solved the testing so ok to merge

@emmacunningham emmacunningham merged commit f6a1f1d into elastic:master Mar 8, 2019
markov00 pushed a commit that referenced this pull request Mar 8, 2019
## [3.0.1](v3.0.0...v3.0.1) (2019-03-08)

### Bug Fixes

* **canvas_text_bbox_calculator:** increase font scaling factor ([#93](#93)) ([f6a1f1d](f6a1f1d))
@markov00
Copy link
Member

markov00 commented Mar 8, 2019

🎉 This PR is included in version 3.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@markov00 markov00 added the released Issue released publicly label Mar 8, 2019
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
## [3.0.1](elastic/elastic-charts@v3.0.0...v3.0.1) (2019-03-08)

### Bug Fixes

* **canvas_text_bbox_calculator:** increase font scaling factor ([opensearch-project#93](elastic/elastic-charts#93)) ([f3080a7](elastic/elastic-charts@f3080a7))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Issue released publicly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Axis tick label text getting truncated in Chrome
3 participants