Interface mock up finished?
This commit is contained in:
parent
34af70b90d
commit
111c4ce870
|
@ -1,5 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
import sys
|
||||
from PySide2.QtCore import (
|
||||
QDateTime, Qt
|
||||
)
|
||||
from PySide2.QtWidgets import (
|
||||
QApplication, QMainWindow
|
||||
)
|
||||
|
@ -23,22 +26,50 @@ class UM24Lab(QMainWindow):
|
|||
self.ui.plotCurrent = QtCharts.QChart()
|
||||
self.ui.widgetCurrent.setChart(self.ui.plotCurrent)
|
||||
|
||||
# --- Voltage ---
|
||||
voltage = self.ui.plotVoltage
|
||||
series = QtCharts.QLineSeries()
|
||||
series.setName('Voltage')
|
||||
series = QtCharts.QLineSeries()
|
||||
series.setName('Voltage over time')
|
||||
# Add random demo data
|
||||
for x in range(100):
|
||||
y = random.randint(0, 10)
|
||||
series.append(x, y)
|
||||
voltage.addSeries(series)
|
||||
|
||||
axis_x = QtCharts.QValueAxis()
|
||||
axis_x.setTickCount(60)
|
||||
axis_x.setTitleText('Seconds')
|
||||
voltage.addAxis(axis_x, Qt.AlignBottom)
|
||||
series.attachAxis(axis_x)
|
||||
|
||||
axis_y = QtCharts.QValueAxis()
|
||||
axis_y.setTickCount(10)
|
||||
axis_y.setTitleText('Voltage (V)')
|
||||
voltage.addAxis(axis_y, Qt.AlignLeft)
|
||||
series.attachAxis(axis_y)
|
||||
|
||||
# --- Current ---
|
||||
current = self.ui.plotCurrent
|
||||
series = QtCharts.QLineSeries()
|
||||
series.setName('Current')
|
||||
series = QtCharts.QLineSeries()
|
||||
series.setName('Current over time')
|
||||
# Add random demo data
|
||||
for x in range(100):
|
||||
y = random.randint(0, 10)
|
||||
series.append(x, y)
|
||||
current.addSeries(series)
|
||||
|
||||
axis_x = QtCharts.QValueAxis()
|
||||
axis_x.setTickCount(60)
|
||||
axis_x.setTitleText('Seconds')
|
||||
current.addAxis(axis_x, Qt.AlignBottom)
|
||||
series.attachAxis(axis_x)
|
||||
|
||||
axis_y = QtCharts.QValueAxis()
|
||||
axis_y.setTickCount(10)
|
||||
axis_y.setTitleText('Current (A)')
|
||||
current.addAxis(axis_y, Qt.AlignLeft)
|
||||
series.attachAxis(axis_y)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication(sys.argv)
|
||||
|
|
Loading…
Reference in New Issue