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

Fixes labelOffset not working for vertical axes #4249

Merged
merged 9 commits into from Jul 15, 2017
2 changes: 1 addition & 1 deletion src/core/core.scale.js
Expand Up @@ -619,7 +619,7 @@ module.exports = function(Chart) {

var yLineValue = me.getPixelForTick(index); // xvalues for grid lines
yLineValue += helpers.aliasPixel(lineWidth);
labelY = me.getPixelForTick(index, gridLines.offsetGridLines);
labelY = me.getPixelForTick(index, gridLines.offsetGridLines) + optionTicks.labelOffset;

tx1 = xTickStart;
tx2 = xTickEnd;
Expand Down
41 changes: 41 additions & 0 deletions test/fixtures/core.scale/label-offset-vertical-axes.json
@@ -0,0 +1,41 @@
{
"config": {
"type": "horizontalBar",
"data": {
"labels": ["\u25C0", "\u25A0", "\u25C6", "\u25CF"],
"datasets": [{
"data": [12, 19, 3, 5]
}]
},
"options": {
"legend": false,
"title": false,
"scales": {
"xAxes": [{
"ticks": {
"display": false
},
"gridLines":{
"display": false,
"drawBorder": false
}
}],
"yAxes": [{
"ticks": {
"labelOffset": 25
},
"gridLines":{
"display": false,
"drawBorder": 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.
3 changes: 3 additions & 0 deletions test/specs/core.scale.tests.js
@@ -0,0 +1,3 @@
describe('Core.scale', function() {
describe('auto', jasmine.specsFromFixtures('core.scale'));
});