def __init__(self, parent=None, width=5, height=4, dpi=80):
self.fig = Figure(figsize=(width, height), dpi=dpi)
super(PowerGraph, self).__init__(self.fig)
self.setParent(parent)
self.graph = self.fig.add_subplot(111)
self.clear()
self.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
self.fig.tight_layout()
self.draw()
# Update the graph using the given data
# 'times' should be datetime objects
# 'power' should be in Watts
评论列表
文章目录