X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=src%2Fdygraph.js;h=a28e231426b4b38b09872429088c54baf3fcbc3b;hb=bf50de0db3094fc5155efc8aee14112df2545e42;hp=0b42d863ef26b534df69fe75384a091c755fd7b5;hpb=ca05e26581fd8625f0980f511655e4540f73c2e9;p=dygraphs.git diff --git a/src/dygraph.js b/src/dygraph.js index 0b42d86..a28e231 100644 --- a/src/dygraph.js +++ b/src/dygraph.js @@ -1656,10 +1656,11 @@ Dygraph.prototype.resetZoom = function() { this.zoomed_x_ = false; this.zoomed_y_ = false; - var minDate = this.rawData_[0][0]; - var maxDate = this.rawData_[this.rawData_.length - 1][0]; + //calculate extremes to avoid lack of padding on reset. + var extremes = this.xAxisExtremes(); + var minDate = extremes[0], + maxDate = extremes[1]; - // With only one frame, don't bother calculating extreme ranges. // TODO(danvk): merge this block w/ the code below. if (!this.getBooleanOption("animatedZooms")) { this.dateWindow_ = null;