Remove legacy options:
[dygraphs.git] / auto_tests / tests / axis_labels-deprecated.js
index 6e8e684..da747e5 100644 (file)
@@ -22,16 +22,20 @@ DeprecatedAxisLabelsTestCase.prototype.testDeprecatedDeprecatedXAxisTimeLabelFor
   var graph = document.getElementById("graph");
   var g = new Dygraph(graph, data, opts);
   g.updateOptions({
-    xAxisLabelFormatter: function (totalMinutes) {
-      var hours   = Math.floor( totalMinutes / 60);
-      var minutes = Math.floor((totalMinutes - (hours * 60)));
-      var seconds = Math.round((totalMinutes * 60) - (hours * 3600) - (minutes * 60));
+    axes : {
+      x : {
+        axisLabelFormatter: function (totalMinutes) {
+          var hours   = Math.floor( totalMinutes / 60);
+          var minutes = Math.floor((totalMinutes - (hours * 60)));
+          var seconds = Math.round((totalMinutes * 60) - (hours * 3600) - (minutes * 60));
 
-      if (hours   < 10) hours   = "0" + hours;
-      if (minutes < 10) minutes = "0" + minutes;
-      if (seconds < 10) seconds = "0" + seconds;
+          if (hours   < 10) hours   = "0" + hours;
+          if (minutes < 10) minutes = "0" + minutes;
+          if (seconds < 10) seconds = "0" + seconds;
 
-      return hours + ':' + minutes + ':' + seconds;
+          return hours + ':' + minutes + ':' + seconds;
+        }
+      }
     }
   });
 
@@ -46,19 +50,25 @@ DeprecatedAxisLabelsTestCase.prototype.testDeprecatedAxisLabelFormatter = functi
   var opts = {
     width: 480,
     height: 320,
-    xAxisLabelFormatter: function(x, granularity, opts, dg) {
-      assertEquals('number', typeof(x));
-      assertEquals('number', typeof(granularity));
-      assertEquals('function', typeof(opts));
-      assertEquals('[Dygraph graph]', dg.toString());
-      return 'x' + x;
-    },
-    yAxisLabelFormatter: function(y, granularity, opts, dg) {
-      assertEquals('number', typeof(y));
-      assertEquals('number', typeof(granularity));
-      assertEquals('function', typeof(opts));
-      assertEquals('[Dygraph graph]', dg.toString());
-      return 'y' + y;
+    axes : {
+      x : {
+        axisLabelFormatter: function(x, granularity, opts, dg) {
+          assertEquals('number', typeof(x));
+          assertEquals('number', typeof(granularity));
+          assertEquals('function', typeof(opts));
+          assertEquals('[Dygraph graph]', dg.toString());
+          return 'x' + x;
+        }
+      },
+      y : {
+        axisLabelFormatter: function(y, granularity, opts, dg) {
+          assertEquals('number', typeof(y));
+          assertEquals('number', typeof(granularity));
+          assertEquals('function', typeof(opts));
+          assertEquals('[Dygraph graph]', dg.toString());
+          return 'y' + y;
+        }
+      }
     },
     labels: ['x', 'y']
   };
@@ -80,22 +90,26 @@ DeprecatedAxisLabelsTestCase.prototype.testDeprecatedDateAxisLabelFormatter = fu
   var opts = {
     width: 480,
     height: 320,
-    xAxisLabelFormatter: function(x, granularity, opts, dg) {
-      assertTrue(Dygraph.isDateLike(x));
-      assertEquals('number', typeof(granularity));
-      assertEquals('function', typeof(opts));
-      assertEquals('[Dygraph graph]', dg.toString());
-      return 'x' + Util.formatDate(x);
-    },
-    yAxisLabelFormatter: function(y, granularity, opts, dg) {
-      assertEquals('number', typeof(y));
-      assertEquals('number', typeof(granularity));
-      assertEquals('function', typeof(opts));
-      assertEquals('[Dygraph graph]', dg.toString());
-      return 'y' + y;
-    },
-    axes: {
-      x: { pixelsPerLabel: 60 }
+    axes : {
+      x : {
+        axisLabelFormatter: function(x, granularity, opts, dg) {
+          assertTrue(Dygraph.isDateLike(x));
+          assertEquals('number', typeof(granularity));
+          assertEquals('function', typeof(opts));
+          assertEquals('[Dygraph graph]', dg.toString());
+          return 'x' + Util.formatDate(x);
+        },
+        pixelsPerLabel: 60
+      },
+      y : {
+        axisLabelFormatter: function(y, granularity, opts, dg) {
+          assertEquals('number', typeof(y));
+          assertEquals('number', typeof(granularity));
+          assertEquals('function', typeof(opts));
+          assertEquals('[Dygraph graph]', dg.toString());
+          return 'y' + y;
+        }
+      }
     },
     labels: ['x', 'y']
   };
@@ -120,19 +134,25 @@ DeprecatedAxisLabelsTestCase.prototype.testDeprecatedValueFormatter = function (
   var opts = {
     width: 480,
     height: 320,
-    xValueFormatter: function(x, opts, series_name, dg) {
-      assertEquals('number', typeof(x));
-      assertEquals('function', typeof(opts));
-      assertEquals('string', typeof(series_name));
-      assertEquals('[Dygraph graph]', dg.toString());
-      return 'x' + x;
-    },
-    yValueFormatter: function(y, opts, series_name, dg) {
-      assertEquals('number', typeof(y));
-      assertEquals('function', typeof(opts));
-      assertEquals('string', typeof(series_name));
-      assertEquals('[Dygraph graph]', dg.toString());
-      return 'y' + y;
+    axes : {
+      x : {
+        valueFormatter: function(x, opts, series_name, dg) {
+          assertEquals('number', typeof(x));
+          assertEquals('function', typeof(opts));
+          assertEquals('string', typeof(series_name));
+          assertEquals('[Dygraph graph]', dg.toString());
+          return 'x' + x;
+        }
+      },
+      y : {
+        valueFormatter: function(y, opts, series_name, dg) {
+          assertEquals('number', typeof(y));
+          assertEquals('function', typeof(opts));
+          assertEquals('string', typeof(series_name));
+          assertEquals('[Dygraph graph]', dg.toString());
+          return 'y' + y;
+        }
+      }
     },
     labels: ['x', 'y']
   };
@@ -156,21 +176,27 @@ DeprecatedAxisLabelsTestCase.prototype.testDeprecatedDateValueFormatter = functi
   var opts = {
     width: 480,
     height: 320,
-    xValueFormatter: function(x, opts, series_name, dg) {
-      assertEquals('number', typeof(x));
-      assertEquals('function', typeof(opts));
-      assertEquals('string', typeof(series_name));
-      assertEquals('[Dygraph graph]', dg.toString());
-      return 'x' + Util.formatDate(x);
+    axes : {
+      x : {
+        valueFormatter: function(x, opts, series_name, dg) {
+          assertEquals('number', typeof(x));
+          assertEquals('function', typeof(opts));
+          assertEquals('string', typeof(series_name));
+          assertEquals('[Dygraph graph]', dg.toString());
+          return 'x' + Util.formatDate(x);
+        },
+        pixelsPerLabel: 60
+      },
+      y : {
+        valueFormatter: function(y, opts, series_name, dg) {
+          assertEquals('number', typeof(y));
+          assertEquals('function', typeof(opts));
+          assertEquals('string', typeof(series_name));
+          assertEquals('[Dygraph graph]', dg.toString());
+          return 'y' + y;
+        }
+      }
     },
-    yValueFormatter: function(y, opts, series_name, dg) {
-      assertEquals('number', typeof(y));
-      assertEquals('function', typeof(opts));
-      assertEquals('string', typeof(series_name));
-      assertEquals('[Dygraph graph]', dg.toString());
-      return 'y' + y;
-    },
-    axes: { x: { pixelsPerLabel: 60 } },
     labels: ['x', 'y']
   };
 
@@ -196,17 +222,23 @@ DeprecatedAxisLabelsTestCase.prototype.testDeprecatedAxisLabelFormatterPrecedenc
   var opts = {
     width: 480,
     height: 320,
-    xValueFormatter: function(x) {
-      return 'xvf' + x;
-    },
-    yValueFormatter: function(y) {
-      return 'yvf' + y;
-    },
-    xAxisLabelFormatter: function(x, granularity) {
-      return 'x' + x;
-    },
-    yAxisLabelFormatter: function(y) {
-      return 'y' + y;
+    axes : {
+      x : {
+        valueFormatter: function(x) {
+          return 'xvf' + x;
+        },
+        axisLabelFormatter: function(x, granularity) {
+          return 'x' + x;
+        },
+      },
+      y : {
+        valueFormatter: function(y) {
+          return 'yvf' + y;
+        },
+        axisLabelFormatter: function(y) {
+          return 'y' + y;
+        },
+      }
     },
     labels: ['x', 'y']
   };
@@ -239,23 +271,39 @@ DeprecatedAxisLabelsTestCase.prototype.testDeprecatedAxisLabelFormatterIncrement
   var graph = document.getElementById("graph");
   var g = new Dygraph(graph, data, opts);
   g.updateOptions({
-    xValueFormatter: function(x) {
-      return 'xvf' + x;
+    axes : {
+      x : { 
+        valueFormatter: function(x) {
+          return 'xvf' + x;
+        }
+      }
     }
   });
   g.updateOptions({
-    yValueFormatter: function(y) {
-      return 'yvf' + y;
+    axes : {
+      y : { 
+        valueFormatter: function(y) {
+          return 'yvf' + y;
+        }
+      }
     }
   });
   g.updateOptions({
-    xAxisLabelFormatter: function(x, granularity) {
-      return 'x' + x;
+    axes : {
+      x : { 
+        axisLabelFormatter: function(x) {
+          return 'x' + x;
+        }
+      }
     }
   });
   g.updateOptions({
-    yAxisLabelFormatter: function(y) {
-      return 'y' + y;
+    axes : {
+      y : { 
+        axisLabelFormatter: function(y) {
+          return 'y' + y;
+        }
+      }
     }
   });