Fix: PlotCurveItem now ignores clip-to-view when auto-range is enabled.

This commit is contained in:
Luke Campagnola 2014-01-19 08:37:58 -05:00
parent eae32af0c7
commit ca68f05f1f
2 changed files with 12 additions and 9 deletions

View File

@ -41,6 +41,7 @@ pyqtgraph-0.9.9 [unreleased]
- PolyLineROI.setPen() now changes the pen of its segments as well
- Prevent divide-by-zero in AxisItem
- Major speedup when using ScatterPlotItem in pxMode
- PlotCurveItem ignores clip-to-view when auto range is enabled
pyqtgraph-0.9.8 2013-11-24

View File

@ -531,15 +531,17 @@ class PlotDataItem(GraphicsObject):
## downsampling is expensive; delay until after clipping.
if self.opts['clipToView']:
# this option presumes that x-values have uniform spacing
range = self.viewRect()
if range is not None:
dx = float(x[-1]-x[0]) / (len(x)-1)
# clip to visible region extended by downsampling value
x0 = np.clip(int((range.left()-x[0])/dx)-1*ds , 0, len(x)-1)
x1 = np.clip(int((range.right()-x[0])/dx)+2*ds , 0, len(x)-1)
x = x[x0:x1]
y = y[x0:x1]
view = self.getViewBox()
if view is None or not view.autoRangeEnabled()[0]:
# this option presumes that x-values have uniform spacing
range = self.viewRect()
if range is not None:
dx = float(x[-1]-x[0]) / (len(x)-1)
# clip to visible region extended by downsampling value
x0 = np.clip(int((range.left()-x[0])/dx)-1*ds , 0, len(x)-1)
x1 = np.clip(int((range.right()-x[0])/dx)+2*ds , 0, len(x)-1)
x = x[x0:x1]
y = y[x0:x1]
if ds > 1:
if self.opts['downsampleMethod'] == 'subsample':