-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlivegraph.h
65 lines (56 loc) · 2.1 KB
/
livegraph.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
#ifndef LIVEGRAPH_H
#define LIVEGRAPH_H
#include <QWidget>
#include <QPainter>
#include <QTimer>
#include <QMap>
namespace Ui {
class liveGraph;
}
class liveGraph : public QWidget
{
Q_OBJECT
public:
explicit liveGraph(QWidget *parent = nullptr);
~liveGraph();
void initGraph();
QMap<QString, QString> graphAnnotation;
QMap<QString, QVector<double>> graphAnnotationMinMax;
void incomingDataSlot(int devNum, QString devName, int byteNum, QString byteName, uint32_t wordData, int id, QString parameterName, int binRawValue, double endValue, bool viewInLogFlag, bool isNewData, bool drawGraphFlag, QString drawGraphColor);
void chngMinMaxVisible();
void cleanGraph();
private:
Ui::liveGraph *ui;
QTimer *timer = new QTimer(this); //таймер сек для сдвига ячеек и перерисовки графика
int xShift = 0; //индекс сдвига ячеек разметки поля
void shiftCells();
void paintCurve(QVector<double> points, QString color);
void paintAnnotation();
QVector<int> maxStringSizePix(QFont font, QList<QString> str);
double xShiftPix = 0;
double pictWidth = 0;
double pictHeight = 0;
int verticalLineCount = 0;
int horizontalLineCount = 0;
double oneCellXpix = 0;
double oneCellYpix = 0.0;
double oneStepXpix = 0;
double vZeroLevel = 0;
double scaleErrorPix = 0.0;
QVector<double> findDeltaValue(QVector<double> &points);
double findYScale(const QVector<double> &values);
bool foundFlag = false;
QList<QString> annotationKeys;
QVector<int> rectXSizePix;
int curvesCount = 0;
bool minMaxOnOff = true;
const int oneStepTime = 500;//время для таймера сдвига на шаг и перерисовки (мсек)
const int steps = 120; //ширина графика в шагах
protected:
void mouseEvent(QMouseEvent *event);
void paintEvent(QPaintEvent *event) override;
signals:
void repaintCurves();
void data2graph(int devNum, int byteNum, int id, double endValue, int steps, QString drawGraphColor);
};
#endif // LIVEGRAPH_H