Merge pull request #464 from danvk/sourcemap
[dygraphs.git] / dygraph-options.js
index 334b2f6..b0fad61 100644 (file)
@@ -36,7 +36,7 @@ var DygraphOptions = (function() {
 var DygraphOptions = function(dygraph) {
   /**
    * The dygraph.
-   * @type {Dygraph}
+   * @type {!Dygraph}
    */
   this.dygraph_ = dygraph;
 
@@ -47,8 +47,10 @@ var DygraphOptions = function(dygraph) {
   this.yAxes_ = [];
 
   /**
-   * { options : { axis-specific options. } }
-   * @type {Object} @private
+   * Contains x-axis specific options, which are stored in the options key.
+   * This matches the yAxes_ object structure (by being a dictionary with an
+   * options element) allowing for shared code.
+   * @type {options: Object} @private
    */
   this.xAxis_ = {};
   this.series_ = {};
@@ -71,7 +73,7 @@ var DygraphOptions = function(dygraph) {
  * Not optimal, but does the trick when you're only using two axes.
  * If we move to more axes, this can just become a function.
  *
- * @type {Object.<string, number>}
+ * @type {Object.<number>}
  * @private
  */
 DygraphOptions.AXIS_STRING_MAPPINGS_ = {
@@ -181,7 +183,7 @@ DygraphOptions.prototype.reparseSeries = function() {
 
       if (typeof(axis) == 'string') {
         if (!this.series_.hasOwnProperty(axis)) {
-          Dygraph.error("Series " + seriesName + " wants to share a y-axis with " +
+          console.error("Series " + seriesName + " wants to share a y-axis with " +
                      "series " + axis + ", which does not define its own axis.");
           return;
         }
@@ -288,11 +290,13 @@ DygraphOptions.prototype.getForAxis = function(name, axis) {
   }
 
   // User-specified global options second.
-  var result = this.getGlobalUser_(name);
-  if (result !== null) {
-    return result;
+  // But, hack, ignore globally-specified 'logscale' for 'x' axis declaration.
+  if (!(axis === 'x' && name === 'logscale')) {
+    var result = this.getGlobalUser_(name);
+    if (result !== null) {
+      return result;
+    }
   }
-
   // Default axis options third.
   var defaultAxisOptions = Dygraph.DEFAULT_ATTRS.axes[axisString];
   if (defaultAxisOptions.hasOwnProperty(name)) {
@@ -368,15 +372,6 @@ DygraphOptions.prototype.seriesNames = function() {
   return this.labels_;
 };
 
-/* Are we using this? */
-/**
- * Return the index of the specified series.
- * @param {string} series the series name.
- */
-DygraphOptions.prototype.indexOfSeries = function(series) {
-  return this.series_[series].idx;
-};
-
 return DygraphOptions;
 
 })();