From a9172eb115e99534b325621527dc70ffa9be18e2 Mon Sep 17 00:00:00 2001 From: Robert Konigsberg Date: Sun, 25 Nov 2012 09:26:09 -0500 Subject: [PATCH] Add comments and warnings for legacy options. --- dygraph.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dygraph.js b/dygraph.js index c71d44f..5026649 100644 --- a/dygraph.js +++ b/dygraph.js @@ -418,6 +418,9 @@ Dygraph.prototype.__init__ = function(div, file, attrs) { attrs.animatedZooms = false; } + // DEPRECATION WARNING: All option processing should be moved from + // attrs_ and user_attrs_ to options_, which holds all this information. + // // Dygraphs has many options, some of which interact with one another. // To keep track of everything, we maintain two sets of options: // @@ -2453,7 +2456,6 @@ Dygraph.prototype.computeYAxes_ = function() { } } - // New axes options for (axis = 0; axis < this.axes_.length; axis++) { if (axis === 0) { opts = this.optionsViewForAxis_('y' + (axis ? '2' : '')); @@ -3329,6 +3331,9 @@ Dygraph.mapLegacyOptions_ = function(attrs) { }; var map = function(opt, axis, new_opt) { 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 + " : ... } } }"); set(axis, new_opt, attrs[opt]); delete my_attrs[opt]; } -- 2.7.4