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
36 changes: 36 additions & 0 deletions test/fixtures/core.scale/label-offset-vertical-axes.json
@@ -0,0 +1,36 @@
{
"config": {
"type": "horizontalBar",
"data": {
"labels": ["Red", "Blue", "Yellow", "Green"],
"datasets": [{
"data": [12, 19, 3, 5]
}]
},
"options": {
"responsive": false,
"spanGaps": true,
Copy link
Member

Choose a reason for hiding this comment

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

I would remove that options because it's not used by this test

"legend": false,
"title": false,
"scales": {
"xAxes": [{
"ticks": {
"display": false
}
}],
"yAxes": [{
"ticks": {
"mirror": true,
"labelOffset": -30
}
}]
}
}
},
"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'));
});