From d86beb5a5a4cdccf18641220934f6e71f44ba75e Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Sat, 25 Jan 2014 08:58:54 -0500 Subject: [PATCH] Added setMinimumPlotHeight method, set default min height to 50px. --- pyqtgraph/widgets/MultiPlotWidget.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pyqtgraph/widgets/MultiPlotWidget.py b/pyqtgraph/widgets/MultiPlotWidget.py index 15c65d03..abad55ef 100644 --- a/pyqtgraph/widgets/MultiPlotWidget.py +++ b/pyqtgraph/widgets/MultiPlotWidget.py @@ -12,7 +12,7 @@ __all__ = ['MultiPlotWidget'] class MultiPlotWidget(GraphicsView): """Widget implementing a graphicsView with a single MultiPlotItem inside.""" def __init__(self, parent=None): - self.minPlotHeight = 150 + self.minPlotHeight = 50 self.mPlotItem = MultiPlotItem.MultiPlotItem() GraphicsView.__init__(self, parent) self.enableMouse(False) @@ -29,7 +29,16 @@ class MultiPlotWidget(GraphicsView): if hasattr(m, '__call__'): return m raise AttributeError(attr) - + + def setMinimumPlotHeight(self, min): + """Set the minimum height for each sub-plot displayed. + + If the total height of all plots is greater than the height of the + widget, then a scroll bar will appear to provide access to the entire + set of plots. + """ + self.minPlotHeight = min + self.resizeEvent(None) def widgetGroupInterface(self): return (None, MultiPlotWidget.saveState, MultiPlotWidget.restoreState) @@ -55,7 +64,7 @@ class MultiPlotWidget(GraphicsView): minHeight = len(self.mPlotItem.plots) * self.minPlotHeight if r.height() < minHeight: r.setHeight(minHeight) - r.setWidth(r.width() - 25) + r.setWidth(r.width() - self.verticalScrollBar().width()) self.centralWidget.setGeometry(r) def resizeEvent(self, ev):