pyqtgraphの背景色に問題があります。私はthe only oneではありません。グラフ付きのダイアログボックスが追加されたQGISソフトウェアプラグインを作成しています。バックグラウンドカラーを設定しようとしていますが、QGIS Plugin Reloaderプラグインを使用してプラグインをリロードした後にのみロードされます(プラグインを開発する人々のために作成されたプラグインですので、コードを変更した後、 QGISに登録してください。共通のユーザは使用しません)。pyqtgraph - 再ロード後にのみバックグラウンドカラーが読み込まれる
以下のコードの私の作品:
import pyqtgraph
...
def prepareGraph(self): # loads on button click
self.graphTitle = 'Graph one'
# prepare data - simplified, but data display correctly
self.y = something
self.x = something_else
self.buildGraph()
def buildGraph(self):
""" Add data to the graph """
pyqtgraph.setConfigOption('background', (230,230,230))
pyqtgraph.setConfigOption('foreground', (100,100,100))
dataColor = (102,178,255)
dataBorderColor = (180,220,255)
barGraph = self.graph.graphicsView
barGraph.clear()
barGraph.addItem(pyqtgraph.BarGraphItem(x=range(len(self.x)), height=self.y, width=0.5, brush=dataColor, pen=dataBorderColor))
barGraph.addItem(pyqtgraph.GridItem())
barGraph.getAxis('bottom').setTicks([self.x])
barGraph.setTitle(title=self.graphTitle)
self.showGraph()
def showGraph(self):
self.graph.show()
興味深いのは、すべての問題のないbuildGraph()
負荷のすべての部分、(!でもフォアグラウンドカラー)のみ背景色がないということです。
これは既知のバグですか、または前景色と背景色の設定に違いがありますか?リンクされた質問は私がこの問題を解決するのに役立たなかった。
pyqtgraph==0.9.10 PyQt4==4.11.4 Python 2.7.3