| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
graph.h
Go to the documentation of this file.
1
9
10#ifndef GRAPH_H
11#define GRAPH_H
12
13#include <config.h>
14
15#include "wireshark_dialog.h"
16
17 class QCPAxis;
18 class QCPBars;
19 class QCPGraph;
20 class QCustomPlot;
21
25 class Graph : public QObject {
26 Q_OBJECT
27 public:
29 static constexpr double default_y_axis_factor_ = 1;
30
32 const qreal graph_line_width_ = 1.0;
33
37 enum PlotStyles {
38 psLine,
39 psDotLine,
40 psStepLine,
41 psDotStepLine,
42 psImpulse,
43 psBar,
44 psStackedBar,
45 psDot,
46 psSquare,
47 psDiamond,
48 psCross,
49 psPlus,
50 psCircle
51 };
52
59 explicit Graph(QCustomPlot* parent, QCPAxis* keyAxis = nullptr, QCPAxis* valueAxis = nullptr);
60
64 ~Graph();
65
70 QString name() const { return name_; }
71
76 void setName(const QString& name);
77
82 QRgb color() const;
83
88 void setColor(const QRgb color);
89
94 bool visible() const { return visible_; }
95
100 void setVisible(bool visible);
101
106 double yAxisFactor() const { return y_axis_factor_; }
107
112 void setYAxisFactor(double y_axis_factor);
113
118 QCPGraph* graph() const { return graph_; }
119
124 QCPBars* bars() const { return bars_; }
125
130 bool addToLegend();
131
137 bool setPlotStyle(PlotStyles style);
138
139 protected:
141 QCustomPlot* parent_;
142
144 QCPGraph* graph_;
145
147 QCPBars* bars_;
148
150 QString name_;
151
153 QBrush color_;
154
156 bool visible_;
157
159 double y_axis_factor_;
160
164 void applyCurrentColor();
165
170 bool removeFromLegend();
171
175 void clearAllData();
176};
177
178#endif // GRAPH_H
Graph::setName
void setName(const QString &name)
Sets the name of the graph.
Definition graph.cpp:36
Graph::graph
QCPGraph * graph() const
Retrieves the underlying QCPGraph object.
Definition graph.h:118
Graph::graph_
QCPGraph * graph_
Definition graph.h:144
Graph::color
QRgb color() const
Retrieves the color of the graph.
Definition graph.cpp:47
Graph::name
QString name() const
Retrieves the name of the graph.
Definition graph.h:70
Graph::visible_
bool visible_
Definition graph.h:156
Graph::bars
QCPBars * bars() const
Retrieves the underlying QCPBars object.
Definition graph.h:124
Graph::PlotStyles
PlotStyles
Defines the available visual styles for plotting data.
Definition graph.h:37
Graph::psDot
@ psDot
Definition graph.h:45
Graph::psStepLine
@ psStepLine
Definition graph.h:40
Graph::psStackedBar
@ psStackedBar
Definition graph.h:44
Graph::psCircle
@ psCircle
Definition graph.h:50
Graph::psBar
@ psBar
Definition graph.h:43
Graph::psLine
@ psLine
Definition graph.h:38
Graph::psImpulse
@ psImpulse
Definition graph.h:42
Graph::psDotLine
@ psDotLine
Definition graph.h:39
Graph::psPlus
@ psPlus
Definition graph.h:49
Graph::psDotStepLine
@ psDotStepLine
Definition graph.h:41
Graph::psCross
@ psCross
Definition graph.h:48
Graph::psSquare
@ psSquare
Definition graph.h:46
Graph::psDiamond
@ psDiamond
Definition graph.h:47
Graph::setPlotStyle
bool setPlotStyle(PlotStyles style)
Sets the visual style of the plot.
Definition graph.cpp:125
Graph::removeFromLegend
bool removeFromLegend()
Removes the graph from the parent plot's legend.
Definition graph.cpp:104
Graph::graph_line_width_
const qreal graph_line_width_
Definition graph.h:32
Graph::default_y_axis_factor_
static constexpr double default_y_axis_factor_
Definition graph.h:29
Graph::name_
QString name_
Definition graph.h:150
Graph::visible
bool visible() const
Checks if the graph is currently visible.
Definition graph.h:94
Graph::color_
QBrush color_
Definition graph.h:153
Graph::bars_
QCPBars * bars_
Definition graph.h:147
Graph::~Graph
~Graph()
Destroys the Graph.
Definition graph.cpp:27
Graph::parent_
QCustomPlot * parent_
Definition graph.h:141
Graph::setVisible
void setVisible(bool visible)
Sets the visibility of the graph.
Definition graph.cpp:77
Graph::yAxisFactor
double yAxisFactor() const
Retrieves the scaling factor for the Y-axis.
Definition graph.h:106
Graph::Graph
Graph(QCustomPlot *parent, QCPAxis *keyAxis=nullptr, QCPAxis *valueAxis=nullptr)
Constructs a new Graph.
Definition graph.cpp:15
Graph::applyCurrentColor
void applyCurrentColor()
Applies the currently set color to the underlying graphical elements.
Definition graph.cpp:58
Graph::setYAxisFactor
void setYAxisFactor(double y_axis_factor)
Sets the scaling factor for the Y-axis.
Definition graph.cpp:88
Graph::y_axis_factor_
double y_axis_factor_
Definition graph.h:159
Graph::setColor
void setColor(const QRgb color)
Sets the color of the graph.
Definition graph.cpp:52
Graph::clearAllData
void clearAllData()
Clears all data points currently loaded into the graph.
Definition graph.cpp:115
Graph::addToLegend
bool addToLegend()
Adds the graph to the parent plot's legend.
Definition graph.cpp:93
wireshark_dialog.h