From: Dan Vanderkam Date: Tue, 30 Apr 2013 16:09:11 +0000 (-0400) Subject: only reserve space for y2 axis when it will be drawn X-Git-Tag: v1.0.0~32 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=9f890c23ad80924d0a30f3a14f8680b7c2d6318e;p=dygraphs.git only reserve space for y2 axis when it will be drawn --- 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' } );