diff --git a/CHANGELOG b/CHANGELOG index 024abc52..cf7a4efd 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 06e0ec1f..adc089a7 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): """