X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-layout.js;h=a14e7f6e31d3fa90896dfc0b90f419eae37efa21;hb=34ad56b341279a066dc8bad129501d8d254699c1;hp=900db689fdec59259281e2f847d37d2312f6dbec;hpb=780a5081d29a3c0a3c4f1d126f0992cf4fc14ebd;p=dygraphs.git diff --git a/dygraph-layout.js b/dygraph-layout.js index 900db68..a14e7f6 100644 --- a/dygraph-layout.js +++ b/dygraph-layout.js @@ -53,12 +53,13 @@ DygraphLayout.prototype.addDataset = function(setname, set_xy) { }; DygraphLayout.prototype.getPlotArea = function() { - return this.computePlotArea_(); + return this.area_; }; // Compute the box which the chart should be drawn in. This is the canvas's // box, less space needed for axis and chart labels. -DygraphLayout.prototype.computePlotArea_ = function() { +// NOTE: This should only be called by Dygraph.predraw_(). +DygraphLayout.prototype.computePlotArea = function() { var area = { // TODO(danvk): per-axis setting. x: 0, @@ -119,12 +120,7 @@ DygraphLayout.prototype.computePlotArea_ = function() { }; this.dygraph_.cascadeEvents_('layout', e); - // Add space for range selector, if needed. - if (this.attr_('showRangeSelector')) { - area.h -= this.attr_('rangeSelectorHeight') + 4; - } - - return area; + this.area_ = area; }; DygraphLayout.prototype.setAnnotations = function(ann) { @@ -134,7 +130,7 @@ DygraphLayout.prototype.setAnnotations = function(ann) { var parse = this.attr_('xValueParser') || function(x) { return x; }; for (var i = 0; i < ann.length; i++) { var a = {}; - if (!ann[i].xval && !ann[i].x) { + if (!ann[i].xval && ann[i].x === undefined) { this.dygraph_.error("Annotations must have an 'x' property"); return; } @@ -233,7 +229,7 @@ DygraphLayout.prototype._evaluateLineCharts = function() { var setName = this.setNames[setIdx]; var axis = this.dygraph_.axisPropertiesForSeries(setName); // TODO (konigsberg): use optionsForAxis instead. - var logscale = this.dygraph_.attributes_.getForSeries("logscale", setIdx); + var logscale = this.dygraph_.attributes_.getForSeries("logscale", setName); // Preallocating the size of points reduces reallocations, and therefore, // calls to collect garbage. @@ -325,7 +321,7 @@ DygraphLayout.prototype.evaluateWithError = function() { var setName = this.setNames[setIdx]; var axis = this.dygraph_.axisPropertiesForSeries(setName); // TODO (konigsberg): use optionsForAxis instead. - var logscale = this.dygraph_.attributes_.getForSeries("logscale", setIdx); + var logscale = this.dygraph_.attributes_.getForSeries("logscale", setName); for (j = 0; j < dataset.length; j++, i++) { var item = dataset[j];