Skip to content

Commit

Permalink
fix(axis): fix horizontal title positioning to account for title padding
Browse files Browse the repository at this point in the history
12
  • Loading branch information
emmacunningham authored and markov00 committed Jan 31, 2019
1 parent ab7e974 commit 08d1f83
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/react_canvas/axis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export class Axis extends React.PureComponent<AxisProps> {
return null;
}
if (isHorizontal(position)) {
return this.renderOriziontalAxisTitle();
return this.renderHorizontalAxisTitle();
}
return this.renderVerticalAxisTitle();
}
Expand Down Expand Up @@ -229,13 +229,13 @@ export class Axis extends React.PureComponent<AxisProps> {
</Group>
);
}
private renderOriziontalAxisTitle() {
private renderHorizontalAxisTitle() {
const {
axisPosition: { width, height },
axisSpec: { title, position, tickSize, tickPadding },
axisTicksDimensions: { maxLabelBboxHeight },
chartTheme: {
axes: { titleFontSize },
axes: { titleFontSize, titlePadding },
},
debug,
} = this.props;
Expand All @@ -244,7 +244,10 @@ export class Axis extends React.PureComponent<AxisProps> {
return;
}

const top = position === Position.Top ? -maxLabelBboxHeight : maxLabelBboxHeight + tickPadding + tickSize;
const top = position === Position.Top ?
-maxLabelBboxHeight - titlePadding :
maxLabelBboxHeight + tickPadding + tickSize + titlePadding;

const left = 0;
return (
<Group>
Expand Down

0 comments on commit 08d1f83

Please sign in to comment.