X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=plugins%2Faxes.js;h=6623a0b5ce06ca820213cb16cfa3c4aefed9ce59;hb=d569e3a08324168e501e6ba1402273acdae554f9;hp=f7865c8f5304ae39008b0cdc0fd459421ac16d9c;hpb=33e96f11dbac8a6abd033f9a8d6e22914f587e2d;p=dygraphs.git diff --git a/plugins/axes.js b/plugins/axes.js index f7865c8..6623a0b 100644 --- a/plugins/axes.js +++ b/plugins/axes.js @@ -52,12 +52,12 @@ axes.prototype.activate = function(g) { axes.prototype.layout = function(e) { var g = e.dygraph; - if (g.getOption('drawYAxis')) { + if (g.getOptionForAxis('drawAxis', 'y')) { var w = g.getOption('yAxisLabelWidth') + 2 * g.getOption('axisTickSize'); e.reserveSpaceLeft(w); } - if (g.getOption('drawXAxis')) { + if (g.getOptionForAxis('drawAxis', 'x')) { var h; // NOTE: I think this is probably broken now, since g.getOption() now // hits the dictionary. (That is, g.getOption('xAxisHeight') now always @@ -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.getOptionForAxis('drawAxis', 'y')) { + // 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() + ")"); @@ -100,7 +103,8 @@ axes.prototype.clearChart = function(e) { axes.prototype.willDrawChart = function(e) { var g = e.dygraph; - if (!g.getOption('drawXAxis') && !g.getOption('drawYAxis')) return; + + if (!g.getOptionForAxis('drawAxis', 'x') && !g.getOptionForAxis('drawAxis', 'y')) return; // Round pixels to half-integer boundaries for crisper drawing. function halfUp(x) { return Math.round(x) + 0.5; } @@ -161,7 +165,7 @@ axes.prototype.willDrawChart = function(e) { var layout = g.layout_; var area = e.dygraph.plotter_.area; - if (g.getOption('drawYAxis')) { + if (g.getOptionForAxis('drawAxis', 'y')) { if (layout.yticks && layout.yticks.length > 0) { var num_axes = g.numAxes(); for (i = 0; i < layout.yticks.length; i++) { @@ -252,7 +256,7 @@ axes.prototype.willDrawChart = function(e) { } } - if (g.getOption('drawXAxis')) { + if (g.getOptionForAxis('drawAxis', 'x')) { if (layout.xticks) { for (i = 0; i < layout.xticks.length; i++) { tick = layout.xticks[i];