Added check for zero ViewBox width when calculating automatic downsampling ratio. (Prevents zero-division when downsampling is set before Plot is properly created and drawn within a container).

This commit is contained in:
JosefNevrly 2014-03-16 15:13:43 +01:00
parent c8f03e828e
commit 70724a44b3

View File

@ -532,7 +532,8 @@ class PlotDataItem(GraphicsObject):
x0 = (range.left()-x[0]) / dx
x1 = (range.right()-x[0]) / dx
width = self.getViewBox().width()
ds = int(max(1, int(0.2 * (x1-x0) / width)))
if width != 0.0:
ds = int(max(1, int(0.2 * (x1-x0) / width)))
## downsampling is expensive; delay until after clipping.
if self.opts['clipToView']: