-
Notifications
You must be signed in to change notification settings - Fork 3
/
chartrealtime.h
92 lines (79 loc) · 2.32 KB
/
chartrealtime.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* Author: Yuriy Kuzin
* sure it's based on example provided by qcustomplot
*/
#ifndef CHARTREALTIME_H
#define CHARTREALTIME_H
#include <QObject>
#include <QWidget>
#include <QTimer>
#include <QDockWidget>
#include <QColor>
#include <limits>
#include "qcustomplot.h"
class chartRealTime : public QMainWindow
{
Q_OBJECT
//window(dock) title
Q_PROPERTY(QString windowTitle
READ getWindowTitle
WRITE setWindowTitle
)
//range how much data range on chart
Q_PROPERTY(int range
READ getRange
WRITE setRange
)
public:
explicit chartRealTime(QMainWindow *parent = 0);
~chartRealTime();
QGridLayout *main_gridlayout;
void setupRealtimeDataDemo(QCustomPlot *customPlot);
QCustomPlot *customPlot;
QDockWidget *chart_dockwidget;
void dataSlot(QDateTime dateTime, QList<int> data);
void addGraphs(QStringList graphs);
void setYAxisLabel(QString yAxisLabel);
void setPlotTitle(QString plotTitle);
void saveImage(QString imagePath, QString imageType, int width, int height);
//list of colors to use by graphs tried to select unique
QList<QColor> uniColor={ QColor(40,110,255), QColor(0,183,48), QColor(255,0,0),
QColor(0,128,64), QColor(255,200,20), QColor(0,155,175),
QColor(145,0,140), QColor(205,125,0), QColor(0,0,0)};
void setWindowTitle(QString m_windowTitle)
{
windowTitle = m_windowTitle;
emit on_setWindowTitle();
}
QString getWindowTitle() const
{ return windowTitle; }
void setRange(int m_range)
{
range = m_range;
emit on_setRange();
}
int getRange() const
{ return range; }
private:
QString demoName;
QTimer dataTimer;
QString windowTitle;
QTime time;
int range;
bool timeReset;
signals:
void datacoming(QDateTime dateTime, QList<int> data);
void dockLocationChanged(bool state);
public slots:
void reset();
private slots:
//void realtimeDataSlot();
void on_setWindowTitle();
void on_datacoming(QDateTime dateTime, QList<int> data);
void on_visibilityChanged(bool);
void showPointToolTip(QMouseEvent *event);
void on_dockLocationChanged(bool state);
void on_setRange();
protected:
bool eventFilter(QObject* obj, QEvent *event);
};
#endif // CHARTREALTIME_H