From ca68f05f1f3af76059504793f4695856f991f90b Mon Sep 17 00:00:00 2001
From: Luke Campagnola <luke.campagnola@gmail.com>
Date: Sun, 19 Jan 2014 08:37:58 -0500
Subject: [PATCH] Fix: PlotCurveItem now ignores clip-to-view when auto-range
 is enabled.

---
 CHANGELOG                               |  1 +
 pyqtgraph/graphicsItems/PlotDataItem.py | 20 +++++++++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 77a7509a..3db12cb9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
 
diff --git a/pyqtgraph/graphicsItems/PlotDataItem.py b/pyqtgraph/graphicsItems/PlotDataItem.py
index e8c4145c..c1f9fd6a 100644
--- a/pyqtgraph/graphicsItems/PlotDataItem.py
+++ b/pyqtgraph/graphicsItems/PlotDataItem.py
@@ -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':
-- 
GitLab