本文整理汇总了Python中pyqtgraph.GraphicsObject方法的典型用法代码示例。如果您正苦于以下问题:Python pyqtgraph.GraphicsObject方法的具体用法?Python pyqtgraph.GraphicsObject怎么用?Python pyqtgraph.GraphicsObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph
的用法示例。
在下文中一共展示了pyqtgraph.GraphicsObject方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsObject [as 别名]
def __init__(self, gitem, **params):
ParamObj.__init__(self)
pg.GraphicsObject.__init__(self) #, [0,0], [1,1])
self.gitem = gitem
self.surfaces = gitem.surfaces
gitem.setParentItem(self)
self.roi = pg.ROI([0,0], [1,1])
self.roi.addRotateHandle([1, 1], [0.5, 0.5])
self.roi.setParentItem(self)
defaults = {
'pos': Point(0,0),
'angle': 0,
}
defaults.update(params)
self._ior_cache = {}
self.roi.sigRegionChanged.connect(self.roiChanged)
self.setParams(**defaults)
示例2: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsObject [as 别名]
def __init__(
self,
widget: ChartWidget,
manager: BarManager,
plots: Dict[str, pg.GraphicsObject],
item_plot_map: Dict[ChartItem, pg.GraphicsObject]
):
""""""
super().__init__()
self._widget: ChartWidget = widget
self._manager: BarManager = manager
self._plots: Dict[str, pg.GraphicsObject] = plots
self._item_plot_map: Dict[ChartItem, pg.GraphicsObject] = item_plot_map
self._x: int = 0
self._y: int = 0
self._plot_name: str = ""
self._init_ui()
self._connect_signal()
示例3: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsObject [as 别名]
def __init__(self, data):
"""初始化"""
pg.GraphicsObject.__init__(self)
# 数据格式: [ (time, open, close, low, high),...]
self.data = data
# 只重画部分图形,大大提高界面更新速度
self.rect = None
self.picture = None
self.setFlag(self.ItemUsesExtendedStyleOption)
# 画笔和画刷
w = 0.4
self.offset = 0
self.low = 0
self.high = 1
self.picture = QtGui.QPicture()
self.pictures = []
self.gPen = pg.mkPen(color=(1, 255, 7, 255), width=w*2)
self.gBrush = pg.mkBrush((1, 255, 7, 255))
self.bPen = pg.mkPen(color=(0, 240, 240, 255), width=w*2)
self.bBrush = pg.mkBrush((0, 240, 240, 255))
self.rPen = pg.mkPen(color=(255, 60, 60, 255), width=w*2)
self.rBrush = pg.mkBrush((255, 60, 60, 255))
self.rBrush.setStyle(Qt.NoBrush)
# 刷新K线
self.generatePicture(self.data)
# 画K线
#----------------------------------------------------------------------
示例4: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsObject [as 别名]
def __init__(self, data):
pg.GraphicsObject.__init__(self)
self.data = data ## data must have fields: time, open, close, min, max
self.generatePicture()
示例5: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsObject [as 别名]
def __init__(self, data):
"""初始化"""
pg.GraphicsObject.__init__(self)
# 数据格式: [ (time, open, close, low, high),...]
self.data = data
# 只重画部分图形,大大提高界面更新速度
self.rect = None
self.picture = None
self.setFlag(self.ItemUsesExtendedStyleOption)
# 画笔和画刷
w = 0.4
self.offset = 0
self.low = 0
self.high = 1
self.picture = QtGui.QPicture()
self.pictures = []
self.bPen = pg.mkPen(color=(0, 240, 240, 255), width=w*2) # 阴线画笔
self.bBrush = pg.mkBrush((0, 240, 240, 255)) # 阴线主体
self.rPen = pg.mkPen(color=(255, 60, 60, 255), width=w*2) # 阳线画笔
self.rBrush = pg.mkBrush((255, 60, 60, 255)) # 阳线主体
self.rBrush.setStyle(QtCore.Qt.NoBrush)
# 刷新K线
self.generatePicture(self.data)
# 画K线
#----------------------------------------------------------------------
示例6: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsObject [as 别名]
def __init__(self, data):
"""初始化"""
pg.GraphicsObject.__init__(self)
# 数据格式: [ (time, open, close, low, high),...]
self.data = data
# 只重画部分图形,大大提高界面更新速度
self.rect = None
self.picture = None
self.setFlag(self.ItemUsesExtendedStyleOption)
# 画笔和画刷
w = 0.4
self.offset = 0
self.low = 0
self.high = 1
self.picture = QtGui.QPicture()
self.pictures = []
self.bPen = pg.mkPen(color=(0, 240, 240, 255), width=w*2)
self.bBrush = pg.mkBrush((0, 240, 240, 255))
self.rPen = pg.mkPen(color=(255, 60, 60, 255), width=w*2)
self.rBrush = pg.mkBrush((255, 60, 60, 255))
self.rBrush.setStyle(Qt.NoBrush)
# 刷新K线
self.generatePicture(self.data)
# 画K线
#----------------------------------------------------------------------
示例7: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsObject [as 别名]
def __init__(self, data):
pg.GraphicsObject.__init__(self)
self.data = data ## data must have fields: time, open, close, min, max
self.generatePicture()
示例8: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsObject [as 别名]
def __init__(self, region: _ChoroplethRegion, pen: QPen, brush: QBrush):
pg.GraphicsObject.__init__(self)
self.region = region
self.agg_value = None
self.pen = pen
self.brush = brush
self._region_info = self._get_region_info(self.region)
self._bounding_rect = reduce(
lambda br1, br2: br1.united(br2),
(qpoly.boundingRect() for qpoly in self.region.qpolys)
)
示例9: initializeGraphWidgets
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsObject [as 别名]
def initializeGraphWidgets(self):
pg.setConfigOption('foreground', 'w')
pg.setConfigOption('background', (32, 48, 68))
pg.GraphicsLayout(border=(100,100,100))
self.strPlot1Title = str(self.theSettings.SETT_GetSettings()["strTradingPair"]) + ' Coinbase Pro Market Price (' + str(self.theSettings.SETT_GetSettings()["strFiatType"]) + ')'
self.plot1 = pg.PlotWidget(title=self.strPlot1Title, axisItems={'bottom': TimeAxisItem(orientation='bottom')})
self.plot1.setYRange(self.minInPlot1, self.maxInPlot1)
self.plot1.setMouseEnabled(False, False) # Mettre False, True pour release
self.plot1.setMenuEnabled(False)
axis = self.plot1.getAxis('bottom') # This is the trick
axis.setStyle(textFillLimits = [(0, 0.7)])
#self.plot1.plotItem.vb.setBackgroundColor((15, 25, 34, 255))
self.plot2 = pg.PlotWidget(title='Astibot decision indicator (normalized)')
self.plot2.showGrid(x=True,y=True,alpha=0.1)
self.plot2.setYRange(-100, 100)
self.plot2.setMouseEnabled(False, True)
self.plot2.setMouseEnabled(False)
self.plot2.hideAxis('bottom')
# Graphs take one row but 2 columns
self.mainGridLayout.addWidget(self.plot1, 9, 1, 1, 2)
self.mainGridLayout.addWidget(self.plot2, 10, 1, 1, 2)
# Graph curves initialization
self.plot1GraphLivePrice = self.plot1.plot(x=self.graphDataTime, y=self.graphDataBitcoinPrice, name=' Price') # , clipToView=True
self.plot1GraphLivePrice.setPen(color=(220,220,220), width=3)
self.plot1GraphSmoothPriceFast = self.plot1.plot(x=self.graphDataTime, y=self.graphDataBitcoinPriceSmoothFast, name=' Price Fast MA')
self.plot1GraphSmoothPriceFast.setPen(color=(3,86,243), width=2)
self.plot1GraphSmoothPriceSlow = self.plot1.plot(x=self.graphDataTime, y=self.graphDataBitcoinPriceSmoothSlow, name=' Price Slow MA')
self.plot1GraphSmoothPriceSlow.setPen(color=(230,79,6), width=2)
self.plot1GraphRiskLine = self.plot1.plot(x=self.graphDataTime, y=self.graphDataBitcoinRiskLine, name=' Risk Line')
self.plot1GraphRiskLine.setPen(color=(255,46,46), width=2, style=QtCore.Qt.DotLine)
self.plot1Markers1 = self.plot1.plot(x=self.graphDataTime, y=self.graphDataBitcoinPriceMarker1, name=' Buy', pen=None, symbol='o', symbolPen=(43, 206, 55), symbolBrush=(43, 206, 55), symbolSize = 30)
self.plot1Markers2 = self.plot1.plot(x=self.graphDataTime, y=self.graphDataBitcoinPriceMarker2, name=' Sell', pen=None, symbol='o', symbolPen=(255, 0, 0), symbolBrush=(255, 0, 0), symbolSize = 30)
# Graph 2 (Indicators) curves initialization
self.plot2GraphIndicatorMACD = self.plot2.plot(x=self.graphDataTime, y=self.graphDataIndicatorMACD, pen='y', name=' MACD')
self.graphicObject = pg.GraphicsObject()