HX_CoalFlowDetect/view/coalstatisticschartwidget.h

114 lines
2.8 KiB
C
Raw Normal View History

2024-11-11 22:19:24 +08:00
#ifndef COALSTATISTICSCHARTWIDGET_H
2024-11-01 17:40:37 +08:00
#define COALSTATISTICSCHARTWIDGET_H
2024-11-11 22:19:24 +08:00
#include "component/qcustomplot/qcustomplot.h"
2024-11-01 17:40:37 +08:00
#include <QWidget>
#include <QtCharts>
QT_CHARTS_USE_NAMESPACE
namespace Ui {
class CoalStatisticsChartWidget;
}
2024-11-05 17:48:05 +08:00
enum TimeUnit {
2024-11-12 17:35:54 +08:00
Hour = 0, // 时
Day = 1, // 天
Month = 2, // 月
Year = 3 // 年
2024-11-05 17:48:05 +08:00
};
2024-11-01 17:40:37 +08:00
class CoalStatisticsChartWidget : public QWidget {
2024-11-12 17:35:54 +08:00
Q_OBJECT
2024-11-01 17:40:37 +08:00
public:
2024-11-12 17:35:54 +08:00
explicit CoalStatisticsChartWidget(QWidget* parent = nullptr);
~CoalStatisticsChartWidget();
2024-11-01 17:40:37 +08:00
2024-11-11 17:48:22 +08:00
signals:
2024-11-12 17:35:54 +08:00
void querySuccessInfo(QString& queryInfo);
2024-11-11 17:48:22 +08:00
2024-11-05 17:48:05 +08:00
private slots:
2024-11-12 17:35:54 +08:00
/**
2024-11-11 22:19:24 +08:00
* @brief on_pushButton_coalStatisOk_clicked
*/
2024-11-12 17:35:54 +08:00
void on_pushButton_coalStatisOk_clicked();
2024-11-05 17:48:05 +08:00
2024-11-01 17:40:37 +08:00
private:
2024-11-12 17:35:54 +08:00
/**
2024-11-11 22:19:24 +08:00
* @brief initCoalStatisticsBarChart
*/
2024-11-12 17:35:54 +08:00
void initCoalStatisticsBarChart();
2024-11-11 22:19:24 +08:00
2024-11-12 17:35:54 +08:00
/**
2024-11-11 22:19:24 +08:00
* @brief formatTimeRange
* @param beginTimeStr
* @param endTimeStr
* @param formattedBeginTime
* @param formattedEndTime
*/
2024-11-12 17:35:54 +08:00
void formatTimeRange(const QString& beginTimeStr, const QString& endTimeStr, QString& formattedBeginTime, QString& formattedEndTime);
/**
* @brief getLastSixFullHours
* @param currentTime
* @return
*/
QList<QString> getLastSixFullHours(const QDateTime& currentTime);
/**
* @brief initCustomCoalStatisticsBarChart
*/
void initCustomCoalStatisticsBarChart();
/**
* @brief initCustomPlotCoalStatisticsBarChart customPlot柱状图
*/
void initCustomPlotCoalStatisticsBarChart();
/**
* @brief getCoalStatisInfoByHttpRequest Http请求获取煤量统计信息
* @param startTime
* @param endTime
* @param statisticUnit
* @param volumeDataMap Map
*/
void getCoalStatisInfoByHttpRequest(const QString& startTime,
const QString& endTime,
const QString& statisticUnit);
/**
2024-11-11 22:19:24 +08:00
* @brief updateCoalStatisticsChart
* @param volumeDataMap
*/
2024-11-12 17:35:54 +08:00
void updateCoalStatisticsChart(const QMap<QString, double>& volumeDataMap);
2024-11-04 18:11:55 +08:00
2024-11-01 17:40:37 +08:00
private:
2024-11-12 17:35:54 +08:00
Ui::CoalStatisticsChartWidget* ui;
2024-11-11 22:19:24 +08:00
2024-11-12 17:35:54 +08:00
QChart* m_chart;
QChartView* m_chartView;
QBarSeries* m_series;
QBarCategoryAxis* m_axisX;
// QDateTimeAxis* m_axisX;
// QValueAxis* m_axisX;
QValueAxis* m_axisY;
2024-11-11 22:19:24 +08:00
2024-11-12 17:35:54 +08:00
QTimer* m_timer;
2024-11-01 17:40:37 +08:00
2024-11-12 17:35:54 +08:00
QCustomPlot* m_customPlot;
QCPBars* m_barGraph;
2024-11-05 17:48:05 +08:00
2024-11-12 17:35:54 +08:00
QSettings* m_systemSetting;
2024-11-05 17:48:05 +08:00
2024-11-12 17:35:54 +08:00
double m_toalValue = 0.0;
2024-11-11 17:48:22 +08:00
2024-11-12 17:35:54 +08:00
/**
2024-11-11 22:19:24 +08:00
* @brief m_volumeDataMap
*/
2024-11-12 17:35:54 +08:00
QMap<QString, double> m_volumeDataMap;
2024-11-01 17:40:37 +08:00
};
#endif // COALSTATISTICSCHARTWIDGET_H