- GraphItem reports pixel margins to improve auto-range
 - ViewBox.setRange is more careful about disabling auto range for axes that are set
This commit is contained in:
Luke Campagnola 2013-11-07 12:05:05 -05:00
parent 58ed8ee7bd
commit ccc5e6274a
2 changed files with 12 additions and 9 deletions

View File

@ -110,6 +110,11 @@ class GraphItem(GraphicsObject):
def boundingRect(self):
return self.scatter.boundingRect()
def dataBounds(self, *args, **kwds):
return self.scatter.dataBounds(*args, **kwds)
def pixelPadding(self):
return self.scatter.pixelPadding()

View File

@ -394,6 +394,8 @@ class ViewBox(GraphicsWidget):
"""
#print self.name, "ViewBox.setRange", rect, xRange, yRange, padding
#import traceback
#traceback.print_stack()
changes = {} # axes
setRequested = [False, False]
@ -454,15 +456,11 @@ class ViewBox(GraphicsWidget):
lockY = False
self.updateViewRange(lockX, lockY)
# Disable auto-range if needed
# Disable auto-range for each axis that was requested to be set
if disableAutoRange:
if all(changed):
ax = ViewBox.XYAxes
elif changed[0]:
ax = ViewBox.XAxis
elif changed[1]:
ax = ViewBox.YAxis
self.enableAutoRange(ax, False)
xOff = False if setRequested[0] else None
yOff = False if setRequested[1] else None
self.enableAutoRange(x=xOff, y=yOff)
changed.append(True)
# If nothing has changed, we are done.
@ -1376,7 +1374,7 @@ class ViewBox(GraphicsWidget):
def updateMatrix(self, changed=None):
## Make the childGroup's transform match the requested viewRange.
#print self.name, "updateMAtrix", self.state['targetRange']
#if changed is None:
#changed = [False, False]
#changed = list(changed)