X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=src%2Fdygraph.js;h=4676a2eecb47896ddd5405a8f72ba33d7839bfc5;hb=refs%2Fheads%2Fmaster;hp=ba447392579ee7b0237cf7a777b38ea2f6e3fdf2;hpb=c0e7b6254d879d6ccbfdd97b88eb904cc09cc9c1;p=dygraphs.git diff --git a/src/dygraph.js b/src/dygraph.js index ba44739..4676a2e 100644 --- a/src/dygraph.js +++ b/src/dygraph.js @@ -89,7 +89,7 @@ var Dygraph = function(div, data, opts) { }; Dygraph.NAME = "Dygraph"; -Dygraph.VERSION = "2.0.0"; +Dygraph.VERSION = "2.1.0"; // Various default values Dygraph.DEFAULT_ROLL_PERIOD = 1; @@ -861,7 +861,9 @@ Dygraph.prototype.resizeElements_ = function() { this.graphDiv.style.width = this.width_ + "px"; this.graphDiv.style.height = this.height_ + "px"; - var canvasScale = utils.getContextPixelRatio(this.canvas_ctx_); + var pixelRatioOption = this.getNumericOption('pixelRatio') + + var canvasScale = pixelRatioOption || utils.getContextPixelRatio(this.canvas_ctx_); this.canvas_.width = this.width_ * canvasScale; this.canvas_.height = this.height_ * canvasScale; this.canvas_.style.width = this.width_ + "px"; // for IE @@ -870,7 +872,7 @@ Dygraph.prototype.resizeElements_ = function() { this.canvas_ctx_.scale(canvasScale, canvasScale); } - var hiddenScale = utils.getContextPixelRatio(this.hidden_ctx_); + var hiddenScale = pixelRatioOption || utils.getContextPixelRatio(this.hidden_ctx_); this.hidden_.width = this.width_ * hiddenScale; this.hidden_.height = this.height_ * hiddenScale; this.hidden_.style.width = this.width_ + "px"; // for IE @@ -3101,6 +3103,7 @@ Dygraph.prototype.updateOptions = function(input_attrs, block_redraw) { // copyUserAttrs_ drops the "file" parameter as a convenience to us. var file = input_attrs.file; var attrs = Dygraph.copyUserAttrs_(input_attrs); + var prevNumAxes = this.attributes_.numAxes(); // TODO(danvk): this is a mess. Move these options into attr_. if ('rollPeriod' in attrs) { @@ -3124,6 +3127,7 @@ Dygraph.prototype.updateOptions = function(input_attrs, block_redraw) { this.attributes_.reparseSeries(); + if (prevNumAxes < this.attributes_.numAxes()) this.plotter_.clear(); if (file) { // This event indicates that the data is about to change, but hasn't yet. // TODO(danvk): support cancellation of the update via this event.