Fix logscale. Also fix includeZero (and add tests for it.) Probably fixes all those...
[dygraphs.git] / dygraph.js
index 5026649..9c6b3cf 100644 (file)
@@ -2427,6 +2427,7 @@ Dygraph.prototype.renderGraph_ = function(is_initial_draw) {
  *   indices are into the axes_ array.
  */
 Dygraph.prototype.computeYAxes_ = function() {
+
   // Preserve valueWindow settings if they exist, and if the user hasn't
   // specified a new valueRange.
   var i, valueWindows, seriesName, axis, index, opts, v;
@@ -2449,6 +2450,31 @@ Dygraph.prototype.computeYAxes_ = function() {
     this.axes_[axis] = opts;
   }
 
+  // TODO(konigsberg): REMOVE THIS SILLINESS this should just come from DygraphOptions.
+  // TODO(konigsberg): Add tests for all of these. Currently just tests for
+  // includeZero and logscale.
+
+  // all options which could be applied per-axis:
+  var axisOptions = [
+    'includeZero',
+    'valueRange',
+    'labelsKMB',
+    'labelsKMG2',
+    'pixelsPerYLabel',
+    'yAxisLabelWidth',
+    'axisLabelFontSize',
+    'axisTickSize',
+    'logscale'
+  ];
+
+  // Copy global axis options over to the first axis.
+  for (i = 0; i < axisOptions.length; i++) {
+    var k = axisOptions[i];
+    v = this.attr_(k);
+    if (v) this.axes_[0][k] = v;
+  }
+  // TODO(konigsberg): end of REMOVE THIS SILLINESS
+
   if (valueWindows !== undefined) {
     // Restore valueWindow settings.
     for (index = 0; index < valueWindows.length; index++) {
@@ -3197,6 +3223,7 @@ Dygraph.prototype.parseDataTable_ = function(data) {
   if (annotations.length > 0) {
     this.setAnnotations(annotations, true);
   }
+  this.attributes_.reparseSeries();
 };
 
 /**
@@ -3333,7 +3360,8 @@ Dygraph.mapLegacyOptions_ = function(attrs) {
     if (typeof(attrs[opt]) != 'undefined') {
       Dygraph.warn("Option " + opt + " is deprecated. Use the " +
           new_opt + " option for the " + axis + " axis instead. " +
-          "(e.g. { axes : { " + axis + " : { " + new_opt + " : ... } } }");
+          "(e.g. { axes : { " + axis + " : { " + new_opt + " : ... } } } " +
+          "(see http://dygraphs.com/per-axis.html for more information.");
       set(axis, new_opt, attrs[opt]);
       delete my_attrs[opt];
     }