1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
27
28
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
73
74
78
79
83
84
88
89
93
94
100
101
107
108
109
110
111
112
113
114
115
116
117
118
/* ... */
#include <gui/graph_screen/Graph.hpp>
#include <touchgfx/Color.hpp>
#include <touchgfx/EasingEquations.hpp>
#include <math.h>
Graph::Graph() :
myAlpha(255)
{
}{ ... }
Graph::~Graph()
{
}{ ... }
void Graph::setup(int newWidth, int newHeight, uint16_t lineColor, uint16_t backgroundColor)
{
setWidth(newWidth);
setHeight(newHeight);
graphLinePainter.setColor(lineColor);
graphAreaPainter.setColor(lineColor, getHeight());
graphDotsPainter.setColor(lineColor);
graphDotsBackgroundPainter.setColor(backgroundColor);
graphLine.setLinkedGraph(graphArea);
graphLine.setLinkedGraph(graphDots);
graphLine.setLinkedGraph(graphDotsBackground);
graphLine.setPosition(0, 0, getWidth(), getHeight());
graphLine.setPainter(graphLinePainter);
graphLine.setBuffer(graphBuffer, NUMBER_OF_POINTS);
graphLine.setLineWidth(1);
graphLine.setRange(-1, 77, 400, 0);
graphArea.setPainter(graphAreaPainter);
graphArea.setLineWidth(0);
graphDots.setPainter(graphDotsPainter);
graphDots.setLineWidth(7);
graphDots.setDotShape(0, 90);
graphDotsBackground.setPainter(graphDotsBackgroundPainter);
graphDotsBackground.setLineWidth(9);
graphDotsBackground.setDotShape(0, 30);
add(graphArea);
add(graphLine);
add(graphDotsBackground);
add(graphDots);
}{ ... }
void Graph::setRange(int left, int right, int top, int bottom)
{
graphLine.setRange(left, right, top, bottom);
}{ ... }
void Graph::setLineVisible(bool lineVisible)
{
graphLine.setVisible(lineVisible);
}{ ... }
void Graph::setDotsVisible(bool dotsVisible)
{
graphDots.setVisible(dotsVisible);
}{ ... }
void Graph::setDotsBackgroundVisible(bool dotsBackgroundVisible)
{
graphDotsBackground.setVisible(dotsBackgroundVisible);
}{ ... }
void Graph::setAreaVisible(bool areaVisible)
{
graphArea.setVisible(areaVisible);
}{ ... }
void Graph::setDotShape(int startAngle, int angleStep, int lineWidth)
{
graphDots.setDotShape(startAngle, angleStep);
graphDots.setLineWidth(lineWidth);
graphDots.invalidate();
}{ ... }
void Graph::setDotBackgroundShape(int startAngle, int angleStep, int lineWidth)
{
graphDotsBackground.setDotShape(startAngle, angleStep);
graphDotsBackground.setLineWidth(lineWidth);
graphDots.invalidate();
}{ ... }
void Graph::setAlpha(uint8_t alpha)
{
myAlpha = alpha;
graphLine.setAlpha(myAlpha);
graphArea.setAlpha(myAlpha);
graphDots.setAlpha(myAlpha);
graphDotsBackground.setAlpha(myAlpha);
invalidate();
}{ ... }
uint8_t Graph::getAlpha()
{
return myAlpha;
}{ ... }