77 lines
1.8 KiB
C
77 lines
1.8 KiB
C
|
#ifndef COALSTATICWIDGET_H
|
||
|
#define COALSTATICWIDGET_H
|
||
|
|
||
|
#include <QSettings>
|
||
|
#include <QWidget>
|
||
|
#include <QtCharts>
|
||
|
|
||
|
namespace Ui {
|
||
|
class CoalStaticWidget;
|
||
|
}
|
||
|
|
||
|
class CoalStaticWidget : public QWidget {
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
explicit CoalStaticWidget(QWidget* parent = nullptr);
|
||
|
~CoalStaticWidget();
|
||
|
|
||
|
signals:
|
||
|
void querySuccessInfo(QString queryInfo);
|
||
|
|
||
|
private slots:
|
||
|
void on_pushButton_clicked();
|
||
|
|
||
|
private:
|
||
|
/**
|
||
|
* @brief initCoalStatisticsBarChart 初始化煤量统计柱状图
|
||
|
*/
|
||
|
void initCoalStatisticsBarChart();
|
||
|
|
||
|
/**
|
||
|
* @brief getLastSixFullHours 计算前六个整点时间
|
||
|
* @param currentTime 当前时间
|
||
|
* @return 六个整点数
|
||
|
*/
|
||
|
QList<QString> getLastSixFullHours(const QDateTime& currentTime);
|
||
|
|
||
|
/**
|
||
|
* @brief updateCoalStatisticsChart 更新煤溜统计柱状图数据
|
||
|
* @param volumeDataMap 统计结果数据
|
||
|
*/
|
||
|
void updateCoalStatisticsChart(const QMap<QString, double>& volumeDataMap);
|
||
|
|
||
|
/**
|
||
|
* @brief getCoalStatisInfoByHttpRequest 通过Http请求获取煤量统计信息
|
||
|
* @param startTime 请求起始时间
|
||
|
* @param endTime 请求终止时间
|
||
|
* @param statisticUnit 统计单位
|
||
|
*/
|
||
|
void getCoalStatisInfoByHttpRequest(const QString& startTime, const QString& endTime, const QString& statisticUnit);
|
||
|
|
||
|
private:
|
||
|
Ui::CoalStaticWidget* ui;
|
||
|
|
||
|
// 柱状图标
|
||
|
QChart* m_chart;
|
||
|
QChartView* m_chartView;
|
||
|
QBarSeries* m_series;
|
||
|
// QDateTimeAxis* m_axisX;
|
||
|
QBarCategoryAxis* m_axisX;
|
||
|
QValueAxis* m_axisY;
|
||
|
|
||
|
/**
|
||
|
* @brief m_systemSetting 系统配置信息
|
||
|
*/
|
||
|
QSettings* m_systemSetting;
|
||
|
|
||
|
double m_toalValue = 0.0;
|
||
|
|
||
|
/**
|
||
|
* @brief m_volumeDataMap 查询出煤量数据
|
||
|
*/
|
||
|
QMap<QString, double> m_volumeDataMap;
|
||
|
};
|
||
|
|
||
|
#endif // COALSTATICWIDGET_H
|