From: Dan Vanderkam Date: Tue, 21 Oct 2014 16:28:11 +0000 (-0400) Subject: Only plot a point in range selector if it changes the x-value X-Git-Tag: v1.1.0~33^2~2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=5575fa3660cca92dd0564ac3647e3440fb0a0c07;p=dygraphs.git Only plot a point in range selector if it changes the x-value --- diff --git a/plugins/range-selector.js b/plugins/range-selector.js index 3a70e7d..d8a3c7a 100644 --- a/plugins/range-selector.js +++ b/plugins/range-selector.js @@ -594,6 +594,13 @@ rangeSelector.prototype.drawMiniPlot_ = function() { var dataPoint = combinedSeriesData.data[i]; var x = ((dataPoint[0] !== null) ? ((dataPoint[0] - xExtremes[0])*xFact) : NaN); var y = ((dataPoint[1] !== null) ? (canvasHeight - (dataPoint[1] - combinedSeriesData.yMin)*yFact) : NaN); + + // Skip points that don't change the x-value. Overly fine-grained points + // can cause major slowdowns with the ctx.fill() call below. + if (prevX !== null && Math.round(x) == Math.round(prevX)) { + continue; + } + if (isFinite(x) && isFinite(y)) { if(prevX === null) { ctx.lineTo(x, canvasHeight);