From 9f890c23ad80924d0a30f3a14f8680b7c2d6318e Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Tue, 30 Apr 2013 12:09:11 -0400 Subject: [PATCH] only reserve space for y2 axis when it will be drawn --- plugins/axes.js | 9 ++++++--- tests/two-axes.html | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/axes.js b/plugins/axes.js index f7865c8..cacda86 100644 --- a/plugins/axes.js +++ b/plugins/axes.js @@ -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() + ")"); diff --git a/tests/two-axes.html b/tests/two-axes.html index 3f40b07..cfc36a5 100644 --- a/tests/two-axes.html +++ b/tests/two-axes.html @@ -67,7 +67,7 @@ labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], labelsKMB: true, ylabel: 'Primary y-axis', - y2label: 'Secondary y-axis', + y2label: 'Secondary y-axis' } ); -- 2.7.4