| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Graph Class Reference

Represents a single data graph within a QCustomPlot, managing its data, visual style, and axes mapping. More...

`#include <graph.h>`

Inheritance diagram for Graph:

## Public Types
enum | PlotStyles { psLine , psDotLine , psStepLine , psDotStepLine , psImpulse , psBar , psStackedBar , psDot , psSquare , psDiamond , psCross , psPlus , psCircle }
| Defines the available visual styles for plotting data. More...

## Public Member Functions
| Graph (QCustomPlot *parent, QCPAxis *keyAxis=nullptr, QCPAxis *valueAxis=nullptr)
| Constructs a new Graph.
| ~Graph ()
| Destroys the Graph.
QString | name () const
| Retrieves the name of the graph.
void | setName (const QString &name)
| Sets the name of the graph.
QRgb | color () const
| Retrieves the color of the graph.
void | setColor (const QRgb color)
| Sets the color of the graph.
bool | visible () const
| Checks if the graph is currently visible.
void | setVisible (bool visible)
| Sets the visibility of the graph.
double | yAxisFactor () const
| Retrieves the scaling factor for the Y-axis.
void | setYAxisFactor (double y_axis_factor)
| Sets the scaling factor for the Y-axis.
QCPGraph * | graph () const
| Retrieves the underlying QCPGraph object.
QCPBars * | bars () const
| Retrieves the underlying QCPBars object.
bool | addToLegend ()
| Adds the graph to the parent plot's legend.
bool | setPlotStyle (PlotStyles style)
| Sets the visual style of the plot.

## Public Attributes
const qreal | graph_line_width_ = 1.0

## Static Public Attributes
static constexpr double | default_y_axis_factor_ = 1

## Protected Member Functions
void | applyCurrentColor ()
| Applies the currently set color to the underlying graphical elements.
bool | removeFromLegend ()
| Removes the graph from the parent plot's legend.
void | clearAllData ()
| Clears all data points currently loaded into the graph.

## Protected Attributes
QCustomPlot * | parent_
QCPGraph * | graph_
QCPBars * | bars_
QString | name_
QBrush | color_
bool | visible_
double | y_axis_factor_

## Detailed Description

Represents a single data graph within a QCustomPlot, managing its data, visual style, and axes mapping.

## Member Enumeration Documentation

## ◆ PlotStyles

enum Graph::PlotStyles

Defines the available visual styles for plotting data.

Enumerator
psLine | Continuous line plot.
psDotLine | Dotted line plot.
psStepLine | Step line plot.
psDotStepLine | Dotted step line plot.
psImpulse | Impulse (stem) plot.
psBar | Bar chart.
psStackedBar | Stacked bar chart.
psDot | Data points as dots.
psSquare | Data points as squares.
psDiamond | Data points as diamonds.
psCross | Data points as crosses (x).
psPlus | Data points as plus signs (+).
psCircle | Data points as circles.

## Constructor & Destructor Documentation

## ◆ Graph()

Graph::Graph | ( | QCustomPlot * | parent,
|  | QCPAxis * | keyAxis = nullptr,
|  | QCPAxis * | valueAxis = nullptr )
| explicit

Constructs a new Graph.

Parameters

  parent | The parent QCustomPlot widget.
  keyAxis | The axis to use for key (X) coordinates (defaults to nullptr).
  valueAxis | The axis to use for value (Y) coordinates (defaults to nullptr).

## Member Function Documentation

## ◆ addToLegend()

bool Graph::addToLegend | ( |  | ) |

Adds the graph to the parent plot's legend.

Returns
  True if successfully added, false otherwise.

## ◆ bars()

QCPBars * Graph::bars | ( |  | ) | const
| inline

Retrieves the underlying QCPBars object.

Returns
  A pointer to the QCPBars instance.

## ◆ color()

QRgb Graph::color | ( |  | ) | const

Retrieves the color of the graph.

Returns
  The QRgb color value.

## ◆ graph()

QCPGraph * Graph::graph | ( |  | ) | const
| inline

Retrieves the underlying QCPGraph object.

Returns
  A pointer to the QCPGraph instance.

## ◆ name()

QString Graph::name | ( |  | ) | const
| inline

Retrieves the name of the graph.

Returns
  The graph name.

## ◆ removeFromLegend()

bool Graph::removeFromLegend | ( |  | ) |
| protected

Removes the graph from the parent plot's legend.

Returns
  True if successfully removed, false otherwise.

## ◆ setColor()

void Graph::setColor | ( | const QRgb | color | ) |

Sets the color of the graph.

Parameters

  color | The new QRgb color value.

## ◆ setName()

void Graph::setName | ( | const QString & | name | ) |

Sets the name of the graph.

Parameters

  name | The new name string.

## ◆ setPlotStyle()

bool Graph::setPlotStyle | ( | PlotStyles | style | ) |

Sets the visual style of the plot.

Parameters

  style | The PlotStyles enum value to apply.

Returns
  True if the style was successfully applied, false otherwise.

## ◆ setVisible()

void Graph::setVisible | ( | bool | visible | ) |

Sets the visibility of the graph.

Parameters

  visible | True to show the graph, false to hide it.

## ◆ setYAxisFactor()

void Graph::setYAxisFactor | ( | double | y_axis_factor | ) |

Sets the scaling factor for the Y-axis.

Parameters

  y_axis_factor | The new scaling factor.

## ◆ visible()

bool Graph::visible | ( |  | ) | const
| inline

Checks if the graph is currently visible.

Returns
  True if visible, false otherwise.

## ◆ yAxisFactor()

double Graph::yAxisFactor | ( |  | ) | const
| inline

Retrieves the scaling factor for the Y-axis.

Returns
  The Y-axis factor.

## Member Data Documentation

## ◆ bars_

QCPBars* Graph::bars_
| protected

Pointer to the underlying QCPBars instance.

## ◆ color_

QBrush Graph::color_
| protected

The brush color of the graph.

## ◆ default_y_axis_factor_

double Graph::default_y_axis_factor_ = 1
| static constexpr

The default multiplication factor applied to the Y-axis.

## ◆ graph_

QCPGraph* Graph::graph_
| protected

Pointer to the underlying QCPGraph instance.

## ◆ graph_line_width_

const qreal Graph::graph_line_width_ = 1.0

The default line width used when drawing the graph.

## ◆ name_

QString Graph::name_
| protected

The name of the graph.

## ◆ parent_

QCustomPlot* Graph::parent_
| protected

Pointer to the parent QCustomPlot widget.

## ◆ visible_

bool Graph::visible_
| protected

Flag indicating whether the graph is currently visible.

## ◆ y_axis_factor_

double Graph::y_axis_factor_
| protected

The scaling factor applied to the Y-axis.

The documentation for this class was generated from the following files:

- /builds/wireshark/wireshark/ui/qt/graph.h
- /builds/wireshark/wireshark/ui/qt/graph.cpp