Merge pull request #763 from hhslepicka/fix_downsampling
FIX: Protection over downsampling calculation.
This commit is contained in:
commit
e62889d095
|
@ -527,14 +527,15 @@ class PlotDataItem(GraphicsObject):
|
||||||
if self.opts['autoDownsample']:
|
if self.opts['autoDownsample']:
|
||||||
# this option presumes that x-values have uniform spacing
|
# this option presumes that x-values have uniform spacing
|
||||||
range = self.viewRect()
|
range = self.viewRect()
|
||||||
if range is not None:
|
if range is not None and len(x) > 1:
|
||||||
dx = float(x[-1]-x[0]) / (len(x)-1)
|
dx = float(x[-1]-x[0]) / (len(x)-1)
|
||||||
x0 = (range.left()-x[0]) / dx
|
if dx != 0.0:
|
||||||
x1 = (range.right()-x[0]) / dx
|
x0 = (range.left()-x[0]) / dx
|
||||||
width = self.getViewBox().width()
|
x1 = (range.right()-x[0]) / dx
|
||||||
if width != 0.0:
|
width = self.getViewBox().width()
|
||||||
ds = int(max(1, int((x1-x0) / (width*self.opts['autoDownsampleFactor']))))
|
if width != 0.0:
|
||||||
## downsampling is expensive; delay until after clipping.
|
ds = int(max(1, int((x1-x0) / (width*self.opts['autoDownsampleFactor']))))
|
||||||
|
## downsampling is expensive; delay until after clipping.
|
||||||
|
|
||||||
if self.opts['clipToView']:
|
if self.opts['clipToView']:
|
||||||
view = self.getViewBox()
|
view = self.getViewBox()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user