Skip to content

Commit

Permalink
Fix typos and add borderAliasPixel variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Zamaroth committed Nov 2, 2017
1 parent eb094f5 commit 3523f9b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
9 changes: 5 additions & 4 deletions src/core/core.scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -923,14 +923,15 @@ module.exports = function(Chart) {
var y1 = Math.round(me.top);
var y2 = Math.round(me.bottom);

var borderAliasPixel = helpers.aliasPixel(context.lineWidth);
if (isHorizontal) {
y1 = y2 = options.position === 'top' ? me.bottom : me.top;
y1 += helpers.aliasPixel(context.lineWidth);
y2 += helpers.aliasPixel(context.lineWidth);
y1 += borderAliasPixel;
y2 += borderAliasPixel;
} else {
x1 = x2 = options.position === 'left' ? me.right : me.left;
x1 += helpers.aliasPixel(context.lineWidth);
x2 += helpers.aliasPixel(context.lineWidth);
x1 += borderAliasPixel;
x2 += borderAliasPixel;
}

context.beginPath();
Expand Down
14 changes: 7 additions & 7 deletions src/plugins/plugin.gridlines.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module.exports = function() {
// Marks scale border positions to prevent overlapping of gridLines and scale borders
helpers.each(chart.scales, function(scale) {
var scaleOptions = scale.options;
var glHashByOrientantion = gridLinesHash[!scale.isHorizontal() ? 'horizontal' : 'vertical'];
var glHashByOrientation = gridLinesHash[!scale.isHorizontal() ? 'horizontal' : 'vertical'];
var borderPosition;

// gridLines.drawBorder is deprecated
Expand All @@ -85,14 +85,14 @@ module.exports = function() {
borderPosition = scale.position === 'left' ? scale.right : scale.left;
}

glHashByOrientantion[Math.round(borderPosition)] = true;
glHashByOrientation[Math.round(borderPosition)] = true;
}
});

// Collects gridLines
helpers.each(chart.scales, function(scale) {
var scaleOptions = scale.options;
var glHashByOrientantion = gridLinesHash[scale.isHorizontal() ? 'horizontal' : 'vertical'];
var glHashByOrientation = gridLinesHash[scale.isHorizontal() ? 'horizontal' : 'vertical'];
var position;

if (scaleOptions.display && scaleOptions.gridLines.display && scaleOptions.gridLines.drawOnChartArea) {
Expand All @@ -103,8 +103,8 @@ module.exports = function() {

position = getLineValue(scale, tickIndex, scaleOptions.gridLines.offsetGridLines && ticksCount > 1);

if (glHashByOrientantion[position] === undefined) {
glHashByOrientantion[position] = true;
if (glHashByOrientation[position] === undefined) {
glHashByOrientation[position] = true;
lines.push(getGridLine(chart, scale, position, tickIndex));
}
}
Expand All @@ -114,8 +114,8 @@ module.exports = function() {
if (scaleOptions.gridLines.offsetGridLines) {
position = Math.round(!scale.isHorizontal() ? scale.bottom : scale.right);

if (glHashByOrientantion[position] === undefined) {
glHashByOrientantion[position] = true;
if (glHashByOrientation[position] === undefined) {
glHashByOrientation[position] = true;
lines.push(getGridLine(chart, scale, position, undefined));
}
}
Expand Down

0 comments on commit 3523f9b

Please sign in to comment.