From 268e525d6a971cb7b1f22d0526fe43ae448c3a51 Mon Sep 17 00:00:00 2001 From: Robert Konigsberg Date: Thu, 27 Dec 2012 10:58:58 -0500 Subject: [PATCH] Add test for axisTickSize. Fill out test for yAxisLabelWidth. axisTickSize is no longer required for computeYAxes. --- auto_tests/tests/to_dom_coords.js | 26 +++++++++++++++++++++++++- dygraph.js | 1 - 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/auto_tests/tests/to_dom_coords.js b/auto_tests/tests/to_dom_coords.js index fb878ca..3def1ef 100644 --- a/auto_tests/tests/to_dom_coords.js +++ b/auto_tests/tests/to_dom_coords.js @@ -130,14 +130,38 @@ ToDomCoordsTestCase.prototype.testYAxisLabelWidth = function() { valueRange: [0, 100], dateWindow: [0, 100], width: 500, - height: 500, + height: 500 } var graph = document.getElementById("graph"); g = new Dygraph(graph, [ [0,0], [100,100] ], opts); assertEquals([100, 0], g.toDomCoords(0, 100)); + assertEquals([500, 486], g.toDomCoords(100, 0)); g.updateOptions({ yAxisLabelWidth: 50 }); assertEquals([50, 0], g.toDomCoords(0, 100)); + assertEquals([500, 486], g.toDomCoords(100, 0)); +} + +ToDomCoordsTestCase.prototype.testAxisTickSize = function() { + var opts = { + yAxisLabelWidth: 100, + axisTickSize: 0, + rightGap: 0, + valueRange: [0, 100], + dateWindow: [0, 100], + width: 500, + height: 500 + } + + var graph = document.getElementById("graph"); + g = new Dygraph(graph, [ [0,0], [100,100] ], opts); + + assertEquals([100, 0], g.toDomCoords(0, 100)); + assertEquals([500, 486], g.toDomCoords(100, 0)); + + g.updateOptions({ axisTickSize : 50 }); + assertEquals([200, 0], g.toDomCoords(0, 100)); + assertEquals([500, 386], g.toDomCoords(100, 0)); } diff --git a/dygraph.js b/dygraph.js index e5ec566..2bccd60 100644 --- a/dygraph.js +++ b/dygraph.js @@ -2460,7 +2460,6 @@ Dygraph.prototype.computeYAxes_ = function() { 'valueRange', 'pixelsPerYLabel', 'axisLabelFontSize', - 'axisTickSize' ]; // Copy global axis options over to the first axis. -- 2.7.4