v2.0.0
Loading...
Searching...
No Matches
lineplot.h
Go to the documentation of this file.
1//=============================================================================================================
23
24#ifndef LINEPLOT_H
25#define LINEPLOT_H
26
27//=============================================================================================================
28// INCLUDES
29//=============================================================================================================
30
31#include "../disp_global.h"
32
33//=============================================================================================================
34// EIGEN INCLUDES
35//=============================================================================================================
36
37#include <Eigen/Core>
38
39//=============================================================================================================
40// QT INCLUDES
41//=============================================================================================================
42
43#include <QWidget>
44#include <QSharedPointer>
45#include <QVector>
46
47//=============================================================================================================
48// FORWARD DECLARATIONS
49//=============================================================================================================
50
51//=============================================================================================================
52// DEFINE NAMESPACE DISPLIB
53//=============================================================================================================
54
55namespace DISPLIB
56{
57
58//=============================================================================================================
59// DISPLIB FORWARD DECLARATIONS
60//=============================================================================================================
61
62//=============================================================================================================
70class DISPSHARED_EXPORT LinePlot : public QWidget
71{
72 Q_OBJECT
73
74public:
75 typedef QSharedPointer<LinePlot> SPtr;
76 typedef QSharedPointer<const LinePlot> ConstSPtr;
77
78 //=========================================================================================================
84 LinePlot(QWidget *parent = nullptr);
85
86 //=========================================================================================================
94 LinePlot(const QVector<double>& y,
95 const QString& title = "",
96 QWidget *parent = nullptr);
97
98 //=========================================================================================================
107 LinePlot(const QVector<double>& x,
108 const QVector<double>& y,
109 const QString& title = "",
110 QWidget *parent = nullptr);
111
112 //=========================================================================================================
116 virtual ~LinePlot();
117
118 //=========================================================================================================
124 void setTitle(const QString &p_sTitle);
125
126 //=========================================================================================================
132 void setXLabel(const QString &p_sXLabel);
133
134 //=========================================================================================================
140 void setYLabel(const QString &p_sYLabel);
141
142 //=========================================================================================================
148 void updateData(const QVector<double>& y);
149
150 //=========================================================================================================
157 void updateData(const QVector<double>& x,
158 const QVector<double>& y);
159
160protected:
161 //=========================================================================================================
167 void paintEvent(QPaintEvent *event) override;
168
169private:
170 QString m_sTitle;
171 QString m_sXLabel;
172 QString m_sYLabel;
173 QVector<double> m_vecXData;
174 QVector<double> m_vecYData;
175 double m_dMinX;
176 double m_dMaxX;
177 double m_dMinY;
178 double m_dMaxY;
179};
180
181//=============================================================================================================
182// INLINE DEFINITIONS
183//=============================================================================================================
184
185} // NAMESPACE
186
187#endif // LINEPLOT_H
Export macros and build-info hooks for the DISPLIB shared library.
#define DISPSHARED_EXPORT
Definition disp_global.h:38
2-D display widgets and visualisation helpers (charts, topography, colour maps).
void updateData(const QVector< double > &y)
Definition lineplot.cpp:126
void paintEvent(QPaintEvent *event) override
Definition lineplot.cpp:167
LinePlot(QWidget *parent=nullptr)
Definition lineplot.cpp:45
void setTitle(const QString &p_sTitle)
Definition lineplot.cpp:102
void setXLabel(const QString &p_sXLabel)
Definition lineplot.cpp:110
QSharedPointer< LinePlot > SPtr
Definition lineplot.h:75
void setYLabel(const QString &p_sYLabel)
Definition lineplot.cpp:118
QSharedPointer< const LinePlot > ConstSPtr
Definition lineplot.h:76