diff --git a/smoothie.js b/smoothie.js index ad40ed5..9486b87 100644 --- a/smoothie.js +++ b/smoothie.js @@ -95,6 +95,7 @@ * Add title option, by @mesca * Fix data drop stoppage by rejecting NaNs in append(), by @timdrysdale * Allow setting interpolation per time series, by @WofWca (#123) + * Fix a memory leak appearing when some `timeSeries.disabled === true`, by @WofWca (#132) */ ;(function(exports) { @@ -910,18 +911,18 @@ // For each data set... for (var d = 0; d < this.seriesSet.length; d++) { - context.save(); var timeSeries = this.seriesSet[d].timeSeries; + + // Delete old data that's moved off the left of the chart. + timeSeries.dropOldData(oldestValidTime, chartOptions.maxDataSetLength); if (timeSeries.disabled) { continue; } + context.save(); var dataSet = timeSeries.data, seriesOptions = this.seriesSet[d].options; - // Delete old data that's moved off the left of the chart. - timeSeries.dropOldData(oldestValidTime, chartOptions.maxDataSetLength); - // Set style for this dataSet. context.lineWidth = seriesOptions.lineWidth; context.strokeStyle = seriesOptions.strokeStyle;