Esempio n. 1
0
    def initUI(self):
        #QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10))

        self.fp = PlotWidget(title="A nice test plot")
        self.cosDataSet = PlotDataSet("Graph showing cos",
                                      QtCore.Qt.black,
                                      [180, -180])
        self.sinDataSet = PlotDataSet("One showing sin",
                                      QtCore.Qt.blue,
                                      [180, -180])
        self.negcosDataSet = PlotDataSet("Another one showing -cos",
                                         QtCore.Qt.green,
                                         [180, -180])
        self.negsinDataSet = PlotDataSet("And the last one showing -sin",
                                         QtCore.Qt.magenta,
                                         [180, -180])

        self.fp.addDataset(self.cosDataSet)
        self.fp.addDataset(self.sinDataSet)
        self.fp.addDataset(self.negcosDataSet)
        self.fp.addDataset(self.negsinDataSet)
        self.setGeometry(100, 100, 800, 500)
        self.setWindowTitle('FastPlotTest')
        layout = QtGui.QGridLayout(self)
        layout.addWidget(self.fp)
        self.setLayout(layout)
        self.show()
        self.timer.start()
        self.mod = 0.0
Esempio n. 2
0
    def newLogSetupSelected(self, item):

        if (len(self.logEntrys) > 0):
            log = self.logEntrys[item]
            if (self.previousLog != None):
                self.previousLog.stop()
            log.start()
            self.previousLog = log

            # Setup the plot
            self.plot.removeAllDatasets()
            self.datasets = []
            colorSelector = 0

            info = self.dsList[self.dataSelector.currentIndex()]
            self.plot.setTitle(info.getName())
            minVal = info.getDataRangeMin()
            maxVal = info.getDataRangeMax()

            for d in info.getVariables():
                ds = PlotDataSet(d.getName(), self.colors[colorSelector],
                                 [minVal, maxVal])
                self.datasets.append(ds)
                self.plot.addDataset(ds)
                colorSelector += 1
                pprint(ds)
        if (self.saveFile != None):
            self.plot.stopSaving()
Esempio n. 3
0
class PlotTest(QtGui.QWidget):

    def __init__(self):
        super(PlotTest, self).__init__()

        self.timer = QtCore.QTimer()
        self.timer.setInterval(10)
        self.connect(self.timer, QtCore.SIGNAL("timeout()"), self.adddata)
        self.initUI()

    def initUI(self):
        #QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10))

        self.fp = PlotWidget(title="A nice test plot")
        self.cosDataSet = PlotDataSet("Graph showing cos",
                                      QtCore.Qt.black,
                                      [180, -180])
        self.sinDataSet = PlotDataSet("One showing sin",
                                      QtCore.Qt.blue,
                                      [180, -180])
        self.negcosDataSet = PlotDataSet("Another one showing -cos",
                                         QtCore.Qt.green,
                                         [180, -180])
        self.negsinDataSet = PlotDataSet("And the last one showing -sin",
                                         QtCore.Qt.magenta,
                                         [180, -180])

        self.fp.addDataset(self.cosDataSet)
        self.fp.addDataset(self.sinDataSet)
        self.fp.addDataset(self.negcosDataSet)
        self.fp.addDataset(self.negsinDataSet)
        self.setGeometry(100, 100, 800, 500)
        self.setWindowTitle('FastPlotTest')
        layout = QtGui.QGridLayout(self)
        layout.addWidget(self.fp)
        self.setLayout(layout)
        self.show()
        self.timer.start()
        self.mod = 0.0

    def adddata(self):
        self.mod = self.mod + 0.01
        if (self.mod > math.pi):
            self.mod = -math.pi
        self.cosDataSet.addData(360 * math.cos(self.mod))
        self.sinDataSet.addData(180 * math.sin(self.mod))
        self.negcosDataSet.addData(-180 * math.cos(self.mod))
        self.negsinDataSet.addData(-180 * math.sin(self.mod))