61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
#ifndef DPLINECHART_H
|
||
#define DPLINECHART_H
|
||
|
||
/*******************************************************************************
|
||
** DataPanel-LineChart
|
||
** author dsc
|
||
**
|
||
** 折线图展示面板,用来展示带有时序数据,可以和TimeLine等组件进行时间属性的交互
|
||
** 采用QCustomPlot实现
|
||
**
|
||
******************************************************************************/
|
||
|
||
#include "dpBaseChart.h"
|
||
|
||
class QCustomPlot;
|
||
class QCPRange;
|
||
|
||
class dpLineChart : public dpBaseChart
|
||
{
|
||
Q_OBJECT
|
||
|
||
public:
|
||
dpLineChart(QWidget *parent = nullptr);
|
||
~dpLineChart();
|
||
|
||
void setTimeRange(TimeUnit) override;
|
||
void setDateTime(const QDateTime&) override;
|
||
void viewHistoricalData(const QDateTime&) override;
|
||
|
||
void synchronizeConfigData(const configurationResults&) override;
|
||
|
||
public slots:
|
||
void onSignal_rangeChanged_xAxis(const QCPRange&);
|
||
void onSignal_dataUpdated(const QString& dataKey, const QVariant& data, const QDateTime& timestamp);
|
||
|
||
private:
|
||
//处理关联图形的策略
|
||
enum HandleGraphPolicy
|
||
{
|
||
Remove, //删除
|
||
ReassignToOthrer //重新分配到其它坐标轴
|
||
};
|
||
|
||
void initQCP();
|
||
void arrangeAxes();
|
||
void reLayoutLegend();
|
||
//void handleAssociatedGraphs();
|
||
|
||
QCustomPlot* m_pCustomPlot;
|
||
ChartStyle m_chartStyle;
|
||
qint64 m_timeRange;
|
||
QDateTime m_curDateTime;
|
||
QVector<Axis> m_axes;
|
||
QHash<QString, Graph> m_graphs;
|
||
AxisArrangementMode m_axisArrangementMode;
|
||
bool m_showLegend;
|
||
bool m_updateData;
|
||
};
|
||
|
||
#endif
|