def __init__(self, parent): QwtPlot.__init__(self, parent) self.variables = [] self.insertLegend(QwtLegend(self), QwtPlot.TopLegend) self.setCanvasBackground(Qt.white) self.magnifier = QwtPlotMagnifier(self.canvas()) self.magnifier.setAxisEnabled(QwtPlot.xBottom, False) self.magnifier.setAxisEnabled(QwtPlot.yLeft, True) self.panner = QwtPlotPanner(self.canvas()) self.panner.setAxisEnabled(QwtPlot.xBottom, False) self.panner.setAxisEnabled(QwtPlot.yLeft, True)
def __init__(self, *arg): QwtPlot.__init__(self, *arg) self.plotLayout().setAlignCanvasToScales(True) self.setCanvasBackground(Qt.white) self.legend = QwtLegend() self.legend.setItemMode(QwtLegend.ClickableItem) self.insertLegend(self.legend, QwtPlot.TopLegend) self.grid = QwtPlotGrid() self.grid.attach(self) self.grid.setPen(QPen(Qt.black, 0, Qt.DotLine)) self.zoomer = QwtPlotZoomer(QwtPlot.xBottom, QwtPlot.yLeft, QwtPicker.DragSelection, QwtPicker.AlwaysOn, self.canvas()) self.zoomer.setRubberBandPen(QPen(Qt.green)) self.zoomer.setTrackerPen(QPen(Qt.red)) self.magnifier = QwtPlotMagnifier(self.canvas()) self.panner = QwtPlotPanner(self.canvas()) self.panner.setMouseButton(Qt.LeftButton, Qt.ControlModifier) self.connect(self, SIGNAL("legendClicked(QwtPlotItem*)"), self.togglePlotItemVisibility)