2025-07-09 14:29:29 +08:00
|
|
|
|
#ifndef DPBASECHART_H
|
|
|
|
|
|
#define DPBASECHART_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "dpBaseWidget.h"
|
2025-07-15 19:35:37 +08:00
|
|
|
|
#include "util/Chart/qcustomplot.h"
|
2025-07-09 14:29:29 +08:00
|
|
|
|
|
|
|
|
|
|
class dpBaseChart : public dpBaseWidget
|
|
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
dpBaseChart(QWidget *parent = nullptr);
|
|
|
|
|
|
~dpBaseChart();
|
|
|
|
|
|
|
|
|
|
|
|
void setTimeRange(TimeUnit) {}
|
|
|
|
|
|
void setDateTime(const QDateTime&) {}
|
|
|
|
|
|
void viewHistoricalData(const QDateTime&) {}
|
2025-07-14 15:02:29 +08:00
|
|
|
|
void synchronizeConfigData(const configurationResults&) {}
|
2025-07-09 14:29:29 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
struct ChartStyle
|
|
|
|
|
|
{
|
|
|
|
|
|
QColor bgColor; //背景颜色
|
|
|
|
|
|
QColor axisColor; //坐标轴颜色
|
|
|
|
|
|
QColor tickColor; //刻度颜色
|
|
|
|
|
|
QColor tickLabelColor; //刻度label颜色
|
|
|
|
|
|
QFont tickLabelFont; //刻度label字体
|
2025-07-14 15:02:29 +08:00
|
|
|
|
QPen gridPen; //网格线画笔
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-07-15 19:35:37 +08:00
|
|
|
|
struct AxisConfig //坐标轴配置信息
|
2025-07-14 15:02:29 +08:00
|
|
|
|
{
|
|
|
|
|
|
QString name; //坐标轴名称,例如:电压
|
|
|
|
|
|
QString unit; //坐标轴单位,例如:V
|
|
|
|
|
|
RealTimeDataType dataType;
|
2025-07-09 14:29:29 +08:00
|
|
|
|
};
|
2025-07-15 19:35:37 +08:00
|
|
|
|
struct Axis //坐标轴配置信息
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
AxisConfig _cfg;
|
|
|
|
|
|
QCPAxis* qAxis = nullptr;
|
|
|
|
|
|
|
|
|
|
|
|
Axis(const AxisConfig& cfg, QCPAxisRect* rect)
|
|
|
|
|
|
{
|
|
|
|
|
|
applyConfig(cfg);
|
|
|
|
|
|
qAxis = new QCPAxis(rect, QCPAxis::atRight);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void applyConfig(const AxisConfig& cfg)
|
|
|
|
|
|
{
|
|
|
|
|
|
_cfg.name = cfg.name;
|
|
|
|
|
|
_cfg.unit = cfg.unit;
|
|
|
|
|
|
_cfg.dataType = cfg.dataType;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
~Axis()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(qAxis)
|
|
|
|
|
|
{
|
|
|
|
|
|
delete qAxis;
|
|
|
|
|
|
qAxis = nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2025-07-09 14:29:29 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|