X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=d95f9be544626dc3acc9f1007a9857c5a7f098ff;hb=250bb62bb4614a3c1189c9b5b8b99e182a11db6e;hp=38dd1f447a852aab379f9716b2e68ab752f3db75;hpb=df75aef5d3eb2056253841c2522e61ecf5dc53a2;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index 38dd1f4..d95f9be 100644 --- a/dygraph.js +++ b/dygraph.js @@ -288,6 +288,7 @@ Dygraph.DEFAULT_ATTRS = { // TODO(danvk): support 'onmouseover' and 'never', and remove synonyms. legend: 'onmouseover', // the only relevant value at the moment is 'always'. + legendFollow: false, stepPlot: false, avoidMinZero: false, @@ -1058,11 +1059,11 @@ Dygraph.prototype.createInterface_ = function() { // ... and for static parts of the chart. this.hidden_ = this.createPlotKitCanvas_(this.canvas_); - this.resizeElements_(); - this.canvas_ctx_ = Dygraph.getContext(this.canvas_); this.hidden_ctx_ = Dygraph.getContext(this.hidden_); + this.resizeElements_(); + // The interactive parts of the graph are drawn on top of the chart. this.graphDiv.appendChild(this.hidden_); this.graphDiv.appendChild(this.canvas_); @@ -1108,14 +1109,24 @@ Dygraph.prototype.createInterface_ = function() { Dygraph.prototype.resizeElements_ = function() { this.graphDiv.style.width = this.width_ + "px"; this.graphDiv.style.height = this.height_ + "px"; - this.canvas_.width = this.width_; - this.canvas_.height = this.height_; + + var canvasScale = Dygraph.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 this.canvas_.style.height = this.height_ + "px"; // for IE - this.hidden_.width = this.width_; - this.hidden_.height = this.height_; + if (canvasScale !== 1) { + this.canvas_ctx_.scale(canvasScale, canvasScale); + } + + var hiddenScale = Dygraph.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 this.hidden_.style.height = this.height_ + "px"; // for IE + if (hiddenScale !== 1) { + this.hidden_ctx_.scale(hiddenScale, hiddenScale); + } }; /**