diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-06-06 00:12:52 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-06-06 00:12:52 +0200 |
commit | 9ce77cecba9e782aebeecc1801f42a64a5159106 (patch) | |
tree | 860aec0e5774b89475094ded1b0f0cff74d77f8c /pyk8055/pyplotD.py | |
parent | a4c1219a7557aa23bea4836913f4049a6d02c560 (diff) | |
download | k8055-9ce77cecba9e782aebeecc1801f42a64a5159106.zip k8055-9ce77cecba9e782aebeecc1801f42a64a5159106.tar.gz |
pyplotA.py and pyplotD.py are fixed
Diffstat (limited to 'pyk8055/pyplotD.py')
-rwxr-xr-x | pyk8055/pyplotD.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/pyk8055/pyplotD.py b/pyk8055/pyplotD.py index 16872fa..d39edbe 100755 --- a/pyk8055/pyplotD.py +++ b/pyk8055/pyplotD.py @@ -9,17 +9,18 @@ class DataPlot(QwtPlot): def __init__(self, *args): QwtPlot.__init__(self, *args) + self.setCanvasBackground(Qt.white) # Initialize data self.x = arrayrange(0.0, 100.1, 0.5) self.d1 = 0.0 + zeros(len(self.x), Float) - self.d2 = 1.0 + zeros(len(self.x), Float) # shift data up 1 - self.d3 = 2.0 + zeros(len(self.x), Float) # Shift data up 2... + self.d2 = 1.0 + zeros(len(self.x), Float) + self.d3 = 2.0 + zeros(len(self.x), Float) self.d4 = 3.0 + zeros(len(self.x), Float) self.d5 = 4.0 + zeros(len(self.x), Float) self.setTitle("Simple K8055 datascope") - #self.setAutoLegend(True) + self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend); self.curve1 = QwtPlotCurve("Input 1") self.curve2 = QwtPlotCurve("Input 2") @@ -27,6 +28,12 @@ class DataPlot(QwtPlot): self.curve4 = QwtPlotCurve("Input 4") self.curve5 = QwtPlotCurve("Input 5") + self.curve1.attach(self) + self.curve2.attach(self) + self.curve3.attach(self) + self.curve4.attach(self) + self.curve5.attach(self) + self.curve1.setPen(QPen(Qt.red)) self.curve2.setPen(QPen(Qt.blue)) self.curve3.setPen(QPen(Qt.green)) @@ -46,10 +53,8 @@ class DataPlot(QwtPlot): self.setAxisTitle(QwtPlot.xBottom, "Time (seconds)") self.setAxisTitle(QwtPlot.yLeft, "Values") - self.startTimer(50) - - # init the K8055 board self.k = k8055(0) + self.startTimer(50) # __init__() def timerEvent(self, e): @@ -61,10 +66,10 @@ class DataPlot(QwtPlot): self.d1[0] = self.k.ReadDigitalChannel(1) * 0.95 self.d2 = concatenate((self.d2[:1], self.d2[:-1]), 1) - self.d2[0] = self.k.ReadDigitalChannel(2) * 0.95 + 1 # Shift data up 1 + self.d2[0] = self.k.ReadDigitalChannel(2) * 0.95 + 1 self.d3 = concatenate((self.d3[:1], self.d3[:-1]), 1) - self.d3[0] = self.k.ReadDigitalChannel(3) * 0.95 + 2 # Shift data up 2... + self.d3[0] = self.k.ReadDigitalChannel(3) * 0.95 + 2 self.d4 = concatenate((self.d4[:1], self.d4[:-1]), 1) self.d4[0] = self.k.ReadDigitalChannel(4) * 0.95 + 3 |