Skip to content

Commit

Permalink
only reserve space for y2 axis when it will be drawn
Browse files Browse the repository at this point in the history
  • Loading branch information
danvk committed Apr 30, 2013
1 parent de25451 commit 9f890c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions plugins/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,12 @@ axes.prototype.layout = function(e) {
}

if (g.numAxes() == 2) {
// TODO(danvk): per-axis setting.
var w = g.getOption('yAxisLabelWidth') + 2 * g.getOption('axisTickSize');
e.reserveSpaceRight(w);
// TODO(danvk): introduce a 'drawAxis' per-axis property.
if (g.getOption('drawYAxis')) {
// TODO(danvk): per-axis setting.
var w = g.getOption('yAxisLabelWidth') + 2 * g.getOption('axisTickSize');
e.reserveSpaceRight(w);
}
} else if (g.numAxes() > 2) {
g.error("Only two y-axes are supported at this time. (Trying " +
"to use " + g.numAxes() + ")");
Expand Down
2 changes: 1 addition & 1 deletion tests/two-axes.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h2>Multiple y-axes</h2>
labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ],
labelsKMB: true,
ylabel: 'Primary y-axis',
y2label: 'Secondary y-axis',
y2label: 'Secondary y-axis'
}
);

Expand Down

0 comments on commit 9f890c2

Please sign in to comment.