from
PyQt5.QtWidgets
import
*
import
sys
import
time
from
datetime
import
datetime, timedelta
import
numpy as np
import
pyqtgraph as pg
from
PyQt5.QtGui
import
*
from
PyQt5.QtCore
import
*
class
Window(QMainWindow):
def
__init__(
self
):
super
().__init__()
self
.setWindowTitle(
"PyQtGraph"
)
self
.setGeometry(
100
,
100
,
900
,
550
)
icon
=
QIcon(
"skin.png"
)
self
.setWindowIcon(icon)
self
.UiComponents()
self
.show()
def
UiComponents(
self
):
widget
=
QWidget()
text
=
"Timestamps Plot"
label
=
QLabel(text)
label.setMinimumWidth(
130
)
label.setWordWrap(
True
)
w
=
pg.PlotWidget(axisItems
=
{
'bottom'
: pg.DateAxisItem()})
w.showGrid(x
=
True
, y
=
True
)
now
=
time.time()
x
=
np.linspace(
2
*
np.pi,
1000
*
2
*
np.pi,
8301
)
w.plot(now
-
(
2
*
np.pi
/
x)
*
*
2
*
100
*
np.pi
*
1e7
, np.sin(x), symbol
=
'o'
)
layout
=
QGridLayout()
label.setMinimumWidth(
130
)
widget.setLayout(layout)
layout.addWidget(label,
1
,
0
)
layout.addWidget(w,
0
,
1
,
3
,
1
)
self
.setCentralWidget(widget)
App
=
QApplication(sys.argv)
window
=
Window()
sys.exit(App.
exec
())