x axis log scale.
[dygraphs.git] / auto_tests / tests / dygraph-options-tests.js
index 691b24a..792dcdb 100644 (file)
@@ -30,3 +30,27 @@ DygraphOptionsTestCase.prototype.testGetSeriesNames = function() {
   var o = new DygraphOptions(g);
   assertEquals(["Y", "Y2", "Y3"], o.seriesNames()); 
 };
+
+/*
+ * Ensures that even if logscale is set globally, it doesn't impact the
+ * x axis.
+ */
+DygraphOptionsTestCase.prototype.getLogscaleForX = function() {
+  var opts = {
+    width: 480,
+    height: 320
+  };
+  var data = "X,Y,Y2,Y3\n" +
+      "1,-1,2,3";
+
+  // Kind of annoying that you need a DOM to test the object.
+  var graph = document.getElementById("graph");
+  var g = new Dygraph(graph, data, opts);
+
+  assertFalse(g.getOptionForAxis('logscale', 'x'));
+  assertFalse(g.getOptionForAxis('logscale', 'y'));
+
+  g.updateOptions({ logscale : true });
+  assertFalse(g.getOptionForAxis('logscale', 'x'));
+  assertTrue(g.getOptionForAxis('logscale', 'y'));
+};