Skip to content

Commit

Permalink
fixing axis alignment (1px off)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar committed Dec 5, 2016
1 parent f27f8a1 commit 3d6267e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ui/public/vislib/lib/axis/axis.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,11 @@ export default function AxisFactory(Private) {
}
} else {
const axisSpacing = 2;
selection.attr('width', length + xAxisPadding);
const axisWidth = Math.ceil(length + axisSpacing);
selection.attr('width', axisWidth);
if (position === 'left') {
const translateWidth = length + xAxisPadding - axisSpacing - parseInt(style.lineWidth);
selection.select('g')
.attr('transform', `translate(${translateWidth},0)`);
.attr('transform', `translate(${axisWidth},0)`);
} else if (position === 'right') {
const translateWidth = axisSpacing + parseInt(style.lineWidth);
selection.select('g')
Expand Down Expand Up @@ -304,8 +304,9 @@ export default function AxisFactory(Private) {
.attr('width', width)
.attr('height', height);

const axisClass = self.axisConfig.isHorizontal() ? 'x' : 'y';
svg.append('g')
.attr('class', `axis ${config.get('id')}`)
.attr('class', `${axisClass} axis ${config.get('id')}`)
.call(axis);

const container = svg.select('g.axis').node();
Expand Down

0 comments on commit 3d6267e

Please sign in to comment.