diff --git a/CHANGELOG b/CHANGELOG index 024abc52910d58f94ab07929c9563ae7e0dbf8fd..cf7a4efd42b87b6a59f4c915dd1d84d9d5954308 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -35,6 +35,7 @@ pyqtgraph-0.9.9 [unreleased] when plots do not fit inside the widget. - Added BarGraphItem.shape() to allow better mouse interaction - Added MeshData.cylinder + - Added ViewBox.setBackgroundColor() Bugfixes: - PlotCurveItem now has correct clicking behavior--clicks within a few px diff --git a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py index 06e0ec1f41b5f0e9f03eea06519be06f55f51c4c..adc089a7e70536d08c54b4ca0316ac6efe282779 100644 --- a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py +++ b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py @@ -285,6 +285,15 @@ class ViewBox(GraphicsWidget): self.updateViewRange() self.sigStateChanged.emit(self) + def setBackgroundColor(self, color): + """ + Set the background color of the ViewBox. + + If color is None, then no background will be drawn. + """ + self.background.setVisible(color is not None) + self.state['background'] = color + self.updateBackground() def setMouseMode(self, mode): """