2025-08-25 15:10:02 +08:00
|
|
|
|
#ifndef DPBARSCHART_H
|
|
|
|
|
|
#define DPBARSCHART_H
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
|
|
** DataPanel-BarsChart
|
|
|
|
|
|
** author dsc
|
|
|
|
|
|
**
|
|
|
|
|
|
** 柱状图展示面板,用来展示统计数据(如各类报警、事件的数量)
|
|
|
|
|
|
** 采用QCustomPlot实现
|
|
|
|
|
|
**
|
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#include "dpBaseChart.h"
|
|
|
|
|
|
|
|
|
|
|
|
class QCustomPlot;
|
|
|
|
|
|
class QCPBarsGroup;
|
|
|
|
|
|
|
|
|
|
|
|
class dpBarsChart : public dpBaseChart
|
|
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
dpBarsChart(QWidget *parent = nullptr);
|
|
|
|
|
|
~dpBarsChart();
|
|
|
|
|
|
|
|
|
|
|
|
void setTimeRange(TimeUnit) override;
|
|
|
|
|
|
void setDateTime(const QDateTime&) override;
|
|
|
|
|
|
void viewHistoricalData(const QDateTime&) override;
|
|
|
|
|
|
|
|
|
|
|
|
void synchronizeConfigData(const configurationResults&) override;
|
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
void onSignal_dataUpdated(const QString& dataKey, const QVariant& data, const QDateTime& timestamp);
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
2025-09-01 19:57:02 +08:00
|
|
|
|
struct Bars
|
|
|
|
|
|
{
|
|
|
|
|
|
QColor color;
|
|
|
|
|
|
QString name;
|
|
|
|
|
|
QString dataID;
|
|
|
|
|
|
RealTimeDataType dataType;
|
|
|
|
|
|
QVector<double> keys;
|
|
|
|
|
|
QPointer<QCPBars> qBars;
|
|
|
|
|
|
|
|
|
|
|
|
Bars()
|
|
|
|
|
|
{
|
|
|
|
|
|
name = "";
|
|
|
|
|
|
dataID = "";
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-08-25 15:10:02 +08:00
|
|
|
|
void initQCP();
|
|
|
|
|
|
|
|
|
|
|
|
QCustomPlot* m_pCustomPlot;
|
|
|
|
|
|
ChartStyle m_chartStyle;
|
2025-09-02 16:28:32 +08:00
|
|
|
|
//QCPBarsGroup* m_pBarsGroup;
|
2025-09-01 19:57:02 +08:00
|
|
|
|
QHash<QString, Bars> m_bars;
|
2025-09-02 16:28:32 +08:00
|
|
|
|
QHash<RealTimeDataType, QCPBarsGroup*> m_barsGroups;
|
2025-08-25 15:10:02 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|