1.pyqtchart基本使用,使用replace()替换曲线上的点来实现动态曲线
2.多线程绘制,采用信号和槽机制更新UI界面,防止卡死
运行界面如下:
import random
import math
import time
import threading
from PyQt5.QtChart import (QAreaSeries, QBarSet, QChart, QChartView,
QLineSeries, QPieSeries, QScatterSeries, QSplineSeries,
QStackedBarSeries, QValueAxis)
from PyQt5.QtCore import(
pyqtSlot, QPoint, QPointF, Qt
)
from PyQt5.Qt import (QApplication, QWidget, QPushButton,
QThread,QMutex,pyqtSignal)
from PyQt5.QtGui import QColor, QPainter, QPalette
from PyQt5.QtWidgets import (QCheckBox, QComboBox, QGridLayout, QHBoxLayout,
QLabel, QSizePolicy, QWidget,QPushButton)
class TestChart(QChart):
def __init__(self, parent=None):
super(TestChart, self).__init__(parent)
self.xRange = 500
self.sample