X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=f9d5f5ecfc337862f221f5eddf44c96eb401f8a5;hb=a2da3777b8931b37c644831dc371ccbfae9fd758;hp=ed021cdd419f54194a5cdb3bac78c0233e09441a;hpb=0842b24b38096009a743ee1d28c25c4714fa2123;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index ed021cd..f9d5f5e 100644 --- a/dygraph.js +++ b/dygraph.js @@ -43,6 +43,8 @@ */ +"use strict"; + /** * Creates an interactive, zoomable chart. * @@ -57,7 +59,7 @@ * whether the input data contains error ranges. For a complete list of * options, see http://dygraphs.com/options.html. */ -Dygraph = function(div, data, opts) { +var Dygraph = function(div, data, opts) { if (arguments.length > 0) { if (arguments.length == 4) { // Old versions of dygraphs took in the series labels as a constructor @@ -812,14 +814,6 @@ Dygraph.prototype.createInterface_ = function() { this.rangeSelector_.addToGraph(this.graphDiv, this.layout_); } - // Create the grapher - this.layout_ = new DygraphLayout(this); - - if (this.rangeSelector_) { - // This needs to happen after the graph canvases are added to the div and the layout object is created. - this.rangeSelector_.addToGraph(this.graphDiv, this.layout_); - } - var dygraph = this; Dygraph.addEvent(this.mouseEventElement_, 'mousemove', function(e) { dygraph.mouseMove_(e); @@ -1937,8 +1931,10 @@ Dygraph.prototype.gatherDatasets_ = function(rolledSeries, dateWindow) { if (bars) { for (var j=0; j 0) minY = 0; - // Ensure we have a valid scale, otherwise defualt to zero for safety. + // Ensure we have a valid scale, otherwise default to [0, 1] for safety. if (minY == Infinity) minY = 0; - if (maxY == -Infinity) maxY = 0; + if (maxY == -Infinity) maxY = 1; // Add some padding and round up to an integer to be human-friendly. var span = maxY - minY; @@ -3202,4 +3191,4 @@ Dygraph.addAnnotationRule = function() { } // Older pages may still use this name. -DateGraph = Dygraph; +var DateGraph = Dygraph;