From 5575fa3660cca92dd0564ac3647e3440fb0a0c07 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Tue, 21 Oct 2014 12:28:11 -0400 Subject: [PATCH] Only plot a point in range selector if it changes the x-value --- plugins/range-selector.js | 7 +++++++ 1 file changed, 7 insertions(+) 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); -- 2.7.4