56 lines
1019 B
C++
56 lines
1019 B
C++
#ifndef COALDISTRIBUTCHARTWIDGET_H
|
|
#define COALDISTRIBUTCHARTWIDGET_H
|
|
|
|
#include <QDateTime>
|
|
#include <QTimer>
|
|
#include <QWidget>
|
|
|
|
#include <QtCharts/QBarSeries>
|
|
#include <QtCharts/QBarSet>
|
|
#include <QtCharts/QCategoryAxis>
|
|
#include <QtCharts/QChartView>
|
|
#include <QtCharts/QValueAxis>
|
|
|
|
namespace Ui {
|
|
class CoalDistributChartWidget;
|
|
}
|
|
QT_CHARTS_USE_NAMESPACE
|
|
|
|
class CoalDistributChartWidget : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit CoalDistributChartWidget(QWidget *parent = nullptr);
|
|
~CoalDistributChartWidget();
|
|
|
|
private slots:
|
|
void updateChart();
|
|
|
|
private:
|
|
/**
|
|
* @brief initializeChart初始化图表
|
|
*/
|
|
void initializeChart();
|
|
|
|
/**
|
|
* @brief initializeTimeAxis初始化时间轴
|
|
*/
|
|
void initializeTimeAxis();
|
|
|
|
void updateBarData();
|
|
|
|
void updateTimeAxis();
|
|
|
|
private:
|
|
Ui::CoalDistributChartWidget *ui;
|
|
|
|
QChart *m_chart;
|
|
QBarSeries *m_series;
|
|
QBarSet *m_barSet;
|
|
QCategoryAxis *m_axisX;
|
|
QValueAxis *m_axisY;
|
|
QTimer *m_timer;
|
|
};
|
|
|
|
#endif // COALDISTRIBUTCHARTWIDGET_H
|