Qt implements QChart to draw dynamic curves in real time, and the code can be copied and transplanted.

In this paper , the interface visualization of real-time monitoring sensor data is implemented code by code . When there are 640 data, a refresh rate of 1ms can be achieved. Of course, the actual display may not reach such a high refresh rate . The specific effect is shown in the following figure:

Not much to say, after creating a Qt project, to use QChart, you need to pay attention to the following points:

  • In the .pro file add: QT += charts
  • Add in the file that uses QChart: QT_CHARTS_USE_NAMESPACE
  • QChart must be displayed on the widget, more precisely, it must be displayed in the QGraphicView control, QT encapsulates a ui control class QtCharts for us:

Guess you like

Origin blog.csdn.net/qq_42308217/article/details/123426823