Skip to content

Commit

Permalink
Fix labelOffset not working for vertical axes (#4249)
Browse files Browse the repository at this point in the history
  • Loading branch information
suheb authored and simonbrunel committed Jul 15, 2017
1 parent f16d8a3 commit b03ab1c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/core.scale.js
Expand Up @@ -647,7 +647,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'));
});

0 comments on commit b03ab1c

Please sign in to comment.