Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Static Public Member Functions | List of all members
Plot Class Reference

A single tap-driven data series rendered on a QCustomPlot axis pair. More...

#include <plot.h>

Inheritance diagram for Plot:
Graph

Public Slots

void captureEvent (const CaptureEvent &e)
 React to a capture lifecycle event.
 

Signals

void requestReplot ()
 Emitted to request a lightweight QCustomPlot replot without recalculation.
 
void requestRecalc ()
 Emitted to request a medium-weight value recalculation followed by replot.
 
void requestRetap ()
 Emitted to request a full retap of the capture file.
 

Public Member Functions

 Plot (QCustomPlot *parent, QCPAxis *keyAxis=nullptr, QCPAxis *valueAxis=nullptr)
 Construct a Plot.
 
 ~Plot ()
 Destroy the Plot.
 
void setFilterField (const QString &filter, const QString &field)
 Set the display filter and Y-axis field for this plot.
 
void setPlotStyle (PlotStyles style)
 Set the visual plot style for this series.
 
void setVisible (bool visible)
 Show or hide this plot on the graph.
 
QString configError () const
 Return any configuration error set by setFilterField().
 
double startTime () const
 Return the capture timestamp of the first packet seen by this plot.
 
void setPlotStartTime (double start_time)
 Set the shared plot start time used for relative-time calculations.
 
bool absoluteTime () const
 Return whether this plot uses absolute (wall-clock) time on the X axis.
 
void setAbsoluteTime (bool abs_time)
 Set the X-axis time display mode.
 
void setYAxisFactor (double y_axis_factor)
 Set a multiplier applied to all Y-axis values before plotting.
 
int hfIndex () const
 Return the resolved header field index for the Y-axis field.
 
const std::vector< plot_item_t > & getItems () const
 Return read-only access to the collected plot items.
 
void removeTapListener ()
 Remove this plot's tap listener, if one is registered.
 
uint32_t packetFromTime (double ts) const
 Return the frame number of the packet closest to a given timestamp.
 
void makeCsv (QTextStream &stream) const
 Write all plot items as CSV rows to stream.
 
QCPRange recentDrawnDataRange (int count) const
 Return the key (X-axis) range covering the most recent count items.
 
- Public Member Functions inherited from Graph
 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.
 

Static Public Member Functions

static bool itemCompare (const plot_item_t &a, const plot_item_t &b)
 Compare two plot items by absolute capture timestamp.
 
static bool itemRelCapCompare (const plot_item_t &a, const plot_item_t &b)
 Compare two plot items by relative capture timestamp.
 
static void setAxisColor (QCPAxis *axis, const QPen &pen)
 Set the pen colour of all visual components of a QCPAxis.
 

Additional Inherited Members

- Public Types inherited from Graph
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 Attributes inherited from Graph
const qreal graph_line_width_ = 1.0
 
- Static Public Attributes inherited from Graph
static constexpr double default_y_axis_factor_ = 1
 
- Protected Member Functions inherited from Graph
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 inherited from Graph
QCustomPlot * parent_
 
QCPGraph * graph_
 
QCPBars * bars_
 
QString name_
 
QBrush color_
 
bool visible_
 
double y_axis_factor_
 

Detailed Description

A single tap-driven data series rendered on a QCustomPlot axis pair.

Constructor & Destructor Documentation

◆ Plot()

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

Construct a Plot.

Parameters
parentThe QCustomPlot that owns this graph.
keyAxisThe X axis to plot against, or nullptr for the default.
valueAxisThe Y axis to plot against, or nullptr for the default.

Member Function Documentation

◆ absoluteTime()

bool Plot::absoluteTime ( ) const
inline

Return whether this plot uses absolute (wall-clock) time on the X axis.

Returns
true if the X axis shows absolute timestamps; false for elapsed time.

◆ captureEvent

void Plot::captureEvent ( const CaptureEvent e)
slot

React to a capture lifecycle event.

Parameters
eThe capture event describing the state transition.

◆ configError()

QString Plot::configError ( ) const
inline

Return any configuration error set by setFilterField().

Returns
The configuration error string, or an empty string if none.

◆ getItems()

const std::vector< plot_item_t > & Plot::getItems ( ) const
inline

Return read-only access to the collected plot items.

Returns
A const reference to the vector of plot_item_t values accumulated by the tap callbacks.

◆ hfIndex()

int Plot::hfIndex ( ) const
inline

Return the resolved header field index for the Y-axis field.

Returns
The hf_index for the field set by setFilterField(), or -1 if no valid field has been resolved.

◆ itemCompare()

bool Plot::itemCompare ( const plot_item_t a,
const plot_item_t b 
)
static

Compare two plot items by absolute capture timestamp.

Parameters
aThe first plot item.
bThe second plot item.
Returns
true if a occurred before b.

◆ itemRelCapCompare()

bool Plot::itemRelCapCompare ( const plot_item_t a,
const plot_item_t b 
)
static

Compare two plot items by relative capture timestamp.

Parameters
aThe first plot item.
bThe second plot item.
Returns
true if a has an earlier relative capture time than b.

◆ makeCsv()

void Plot::makeCsv ( QTextStream &  stream) const

Write all plot items as CSV rows to stream.

Parameters
streamThe text stream to write to.

◆ packetFromTime()

uint32_t Plot::packetFromTime ( double  ts) const

Return the frame number of the packet closest to a given timestamp.

Parameters
tsThe target timestamp in seconds.
Returns
The 1-based frame number of the nearest packet, or 0 if items_ is empty.

◆ recentDrawnDataRange()

QCPRange Plot::recentDrawnDataRange ( int  count) const

Return the key (X-axis) range covering the most recent count items.

Parameters
countThe number of most-recent data points to include in the range.
Returns
A QCPRange spanning the timestamps of the last count items, or an empty range if items_ has fewer than count entries.

◆ setAbsoluteTime()

void Plot::setAbsoluteTime ( bool  abs_time)

Set the X-axis time display mode.

Parameters
abs_timetrue to display absolute (wall-clock) timestamps; false to display elapsed time relative to plot_start_time_.

◆ setAxisColor()

void Plot::setAxisColor ( QCPAxis *  axis,
const QPen &  pen 
)
static

Set the pen colour of all visual components of a QCPAxis.

Parameters
axisThe axis to recolour.
penThe pen (colour and width) to apply.

◆ setFilterField()

void Plot::setFilterField ( const QString &  filter,
const QString &  field 
)

Set the display filter and Y-axis field for this plot.

Parameters
filterThe display filter expression (may be empty).
fieldThe header field abbreviation whose value is plotted on the Y axis.

◆ setPlotStartTime()

void Plot::setPlotStartTime ( double  start_time)

Set the shared plot start time used for relative-time calculations.

Parameters
start_timeThe common time origin in seconds.

◆ setPlotStyle()

void Plot::setPlotStyle ( PlotStyles  style)

Set the visual plot style for this series.

Parameters
styleThe desired plot style.

◆ setVisible()

void Plot::setVisible ( bool  visible)

Show or hide this plot on the graph.

Parameters
visibletrue to show and activate the tap; false to hide and deactivate it.

◆ setYAxisFactor()

void Plot::setYAxisFactor ( double  y_axis_factor)

Set a multiplier applied to all Y-axis values before plotting.

Parameters
y_axis_factorThe scale factor; 1.0 means no scaling.

◆ startTime()

double Plot::startTime ( ) const

Return the capture timestamp of the first packet seen by this plot.

Returns
The timestamp of the first packet in seconds, or 0.0 if no packets have been received yet.

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