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
Fixes labelOffset not working for vertical axes #4249
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
efc3c58
Fixes labelOffset not working for vertical axes
suheb e9045a9
Adding test for labelOffset fix for vertical axes
suheb 64a4ac4
Removes unnecessary options for test charts config
suheb 33220aa
Increases tolerance to account for different font rendering
suheb 5989543
Doubling the tolerance for label test
suheb eed700a
Using unicode icons instead of text for labelOffset test
suheb 123193d
Using defaut tolerance value
suheb 1411c83
Replacing test image
suheb 0fa311b
Removing gridlines at zero
suheb File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"tolerance": "0.008", | ||
"config": { | ||
"type": "horizontalBar", | ||
"data": { | ||
"labels": ["Red", "Blue", "Yellow", "Green"], | ||
"datasets": [{ | ||
"data": [12, 19, 3, 5] | ||
}] | ||
}, | ||
"options": { | ||
"legend": false, | ||
"title": false, | ||
"scales": { | ||
"xAxes": [{ | ||
"ticks": { | ||
"display": false | ||
}, | ||
"gridLines":{ | ||
"display": false | ||
} | ||
}], | ||
"yAxes": [{ | ||
"ticks": { | ||
"labelOffset": 25 | ||
}, | ||
"gridLines":{ | ||
"display": false | ||
} | ||
}] | ||
} | ||
} | ||
}, | ||
"options": { | ||
"canvas": { | ||
"height": 256, | ||
"width": 512 | ||
} | ||
} | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
describe('Core.scale', function() { | ||
describe('auto', jasmine.specsFromFixtures('core.scale')); | ||
}); |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.008
might be too high, did you verify locally that the test fails if you temporary change"labelOffset": 25
to20
? Maybe it worths a try to0.005
, the lower the better :)@etimberg I'm curious to know if there is a font that can be consistently rendered on all platforms/browsers that we could use for our unit tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simonbrunel not sure about a specific font. Maybe something monospace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simonbrunel
0.008
is indeed too high. But the test does not fail (which it should) even at0.004
if I change"labelOffset"
from25
to20
for short labels like"1", "2", "3", "4"
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what to do then :\ Unit tests must fail if labels are not correctly positioned, if it doesn't fail with short labels, simply use long labels to make the test relevant. Ideally, tolerance should be
0
(default is0.001
), so pick the lowest value (with long labels) that passes on Travis but that easily fail iflabelOffset
changes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simonbrunel I tried using long labels but then the test was failing even at high tolerance due to different font rendering on browsers/platform. So I tried replacing text with unicode shapes instead and it's working fine for me locally on firefox and chrome (macOS 10.2.3) but still failing on travis. Moreover, I can't see the build log for the latest commit. :/