-
Notifications
You must be signed in to change notification settings - Fork 0
/
chartswidgt.h
127 lines (99 loc) · 2.87 KB
/
chartswidgt.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#ifndef CHARTSWIDGT_H
#define CHARTSWIDGT_H
#include <QtCharts/QChartGlobal>
#include <QtCharts/QChart>
#include <QtCharts/QChartView>
#include <QtWidgets/QWidget>
#include <QtWidgets/QGraphicsWidget>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QGraphicsGridLayout>
#include <QtWidgets/QDoubleSpinBox>
#include <QtWidgets/QGroupBox>
#include <QtCharts/QLineSeries>
#include <QSplineSeries>
#include<QMouseEvent>
#include<QWheelEvent>
#include <QRubberBand>
#include"chartview.h"
#include<QFontMetrics>
#include<QLabel>
#include<QDialog>
#include<QDockWidget>
#include<QColor>
#include<QPointF>
#include<QTimer>
#include "devicesystem.h"
#include"devicesignal.h"
#include"doubleslider.h"
#include"signaldata.h"
QT_CHARTS_USE_NAMESPACE
class chartswidgt : public QWidget
{
Q_OBJECT
public:
explicit chartswidgt(DeviceSystem *system, QWidget *parent = nullptr);
//QWidget *parent = 0
QLabel *label_position;
ChartView *m_chartView;
int plot_size;
void GetSeriesPoint(bool status);
void showDataDialog();
void XAxisAdapt();
void YAxisAdapt();
public slots:
void connectMarkers();
void disconnectMarkers();
void handleMarkerClicked();
void clickpoint(const QPointF &point,bool status);
void show_position(const QPoint &point);
void UpdateChart();
void setMaxRange();
void setMinRange();
void setPlotSize();
void setMaxValue(float val);
void setMinValue(float val);
void on_updateslider();
private:
bool isClicking;
int xOld;
int yOld;
QChart *m_chart;
//QSplineSeries
QVector< QVector<QLineSeries *>> series_list;
QVector< QVector<QVector<QLineSeries *> > > series_can;
QVector<QVector<QVector<QList<QPointF>>>> point_vector;
QVector< QVector <QVector<bool>>> status_vector;
QVector< QVector<bool>> status_list;
QList<QList<QColor>*> color_list;
QList<QList<QString>*> name_list;
QVector<QVector<QList<QPointF>>> point_list;
QList<QSplineSeries *> s_series;
quint16 pchannel;
QVBoxLayout *m_vbox_layout;
QHBoxLayout *m_hbox_layout;
QList<QList<QPointF> > data;
bool get_point_status;
qreal plotXaxis;
QRectF m_rect;
QRectF m_textRect;
QFont m_font;
QTimer *timer= nullptr;
DeviceSystem *device_system = nullptr;
DoubleSlider *h_slider;
DoubleSlider *v_slider;
void InitSeries();
int IndexofSeries(QLineSeries *series, int device, int signal,QString name, QColor color);
float m_min;
float m_max;
QLineEdit *lineEditMaxRange;
QLineEdit *lineEditMinRange;
QLineEdit *lineEditPlotSize;
QList<double> getMaxMinData(bool status);
bool is_update_axis;
QVector<QPointF> getPlotData(QVector<QPointF> &showdata);
signals:
void AddPointData(QString time, QColor color, QString name, QString point);
protected:
void wheelEvent(QWheelEvent *event);
};
#endif // CHARTSWIDGT_H