X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;ds=sidebyside;f=dygraph-canvas.js;h=4ea5ef94a273b418ff6e3ed5c2d5dd461e1752d4;hb=063e83bad654d6b5afcc156f7a2a0be4b2ea8e94;hp=764bac1b001a25fb55c7568aefe1b6dcd5e23360;hpb=d9816e62fc86aab46798e33445f2c5b863b48f9d;p=dygraphs.git diff --git a/dygraph-canvas.js b/dygraph-canvas.js index 764bac1..4ea5ef9 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -344,7 +344,11 @@ DygraphCanvasRenderer.prototype.computeArea_ = function() { area.w = this.width - area.x - this.attr_('rightGap'); area.h = this.height; if (this.attr_('drawXAxis')) { - area.h -= this.attr_('axisLabelFontSize') + 2 * this.attr_('axisTickSize'); + if (this.attr_('xAxisHeight')) { + area.h -= this.attr_('xAxisHeight'); + } else { + area.h -= this.attr_('axisLabelFontSize') + 2 * this.attr_('axisTickSize'); + } } // Shrink the drawing area to accomodate additional y-axes. @@ -1006,6 +1010,10 @@ DygraphCanvasRenderer.prototype._renderLineChart = function() { } } + var isNullOrNaN = function(x) { + return (x === null || isNaN(x)); + }; + for (var i = 0; i < setCount; i++) { var setName = setNames[i]; var color = this.colors[setName]; @@ -1021,7 +1029,7 @@ DygraphCanvasRenderer.prototype._renderLineChart = function() { for (var j = 0; j < points.length; j++) { var point = points[j]; if (point.name == setName) { - if (!Dygraph.isOK(point.canvasy)) { + if (isNullOrNaN(point.canvasy)) { if (stepPlot && prevX != null) { // Draw a horizontal line to the start of the missing data ctx.beginPath(); @@ -1037,7 +1045,7 @@ DygraphCanvasRenderer.prototype._renderLineChart = function() { // A point is "isolated" if it is non-null but both the previous // and next points are null. var isIsolated = (!prevX && (j == points.length - 1 || - !Dygraph.isOK(points[j+1].canvasy))); + isNullOrNaN(points[j+1].canvasy))); if (prevX === null) { prevX = point.canvasx;