Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | List of all members
RectangularPlotWidget Class Reference

Widget for displaying rectangular (Cartesian) plots with dual y-axes It provides a rectangular plot visualization with support for multiple traces, frequency-based markers, limit lines, and independent left/right y-axes. More...

#include <rectangularplotwidget.h>

Inheritance diagram for RectangularPlotWidget:
Inheritance graph
[legend]
Collaboration diagram for RectangularPlotWidget:
Collaboration graph
[legend]

Classes

struct  AxisSettings
 Settings for plot axes and display options. More...
 
struct  Limit
 Data structure representing a limit line segment. More...
 
struct  Marker
 Data structure for the frequency marker. More...
 
struct  Trace
 Data structure representing a trace on the plot. More...
 

Public Member Functions

 RectangularPlotWidget (QWidget *parent=nullptr)
 Class constructor.
 
 ~RectangularPlotWidget ()
 Destructor.
 
void addTrace (const QString &name, const Trace &trace)
 Add or update a trace on the plot.
 
void removeTrace (const QString &name)
 Remove a trace from the plot.
 
void clearTraces ()
 Remove all traces from the plot.
 
double calculateNiceStep (double range)
 Calculate an aesthetically pleasing step size for axis divisions.
 
QPen getTracePen (const QString &traceName) const
 Get the pen style for a specific trace.
 
void setTracePen (const QString &traceName, const QPen &pen)
 Set the pen style for a specific trace.
 
QMap< QString, QPen > getTracesInfo () const
 Get information about all traces.
 
double getYmax ()
 Get maximum left Y-axis value.
 
double getYmin ()
 Get minimum left Y-axis value.
 
double getYdiv ()
 Get left Y-axis division interval.
 
void setYdiv (double val)
 Set left Y-axis division interval.
 
void setYmax (double val)
 Set maximum left Y-axis value.
 
void setYmin (double val)
 Set minimum left Y-axis value.
 
double getY2max ()
 Get maximum right Y-axis value.
 
double getY2min ()
 Get minimum right Y-axis value.
 
double getY2div ()
 Get right Y-axis division interval.
 
double getXmax ()
 Get maximum X-axis value.
 
double getXmin ()
 Get minimum X-axis value.
 
double getXdiv ()
 Get X-axis division interval.
 
double getXscale ()
 Get frequency scale factor for current units.
 
QString getXunits ()
 Get current frequency unit string.
 
int getFreqIndex ()
 Get frequency unit combo box index.
 
void updatePlot ()
 Redraw the entire plot with current data.
 
void set_y_autoscale (bool value)
 Enable or disable automatic Y-axis scaling.
 
bool areAxisSettingsLocked () const
 Check if axis settings are locked.
 
void setRightYAxisEnabled (bool enabled)
 Enable or disable the right Y-axis.
 
bool isRightYAxisEnabled () const
 Check if right Y-axis is enabled.
 
void change_Y_axis_title (QString title)
 Set left Y-axis title.
 
void change_Y_axis_units (QString units)
 Set left Y-axis unit label.
 
void change_Y2_axis_title (QString title)
 Set right Y-axis title.
 
void change_Y2_axis_units (QString units)
 Set right Y-axis unit label.
 
void change_X_axis_title (QString title)
 Set X-axis title.
 
bool addMarker (const QString &markerId, double frequency, const QPen &pen=QPen(Qt::red, 2))
 Add a vertical marker at a specific frequency.
 
bool removeMarker (const QString &markerId)
 Remove a marker from the plot.
 
bool updateMarkerFrequency (const QString &markerId, double newFrequency)
 Update the frequency of an existing marker.
 
void clearMarkers ()
 Remove all markers from the plot.
 
QMap< QString, double > getMarkers () const
 Get all markers and their frequencies.
 
bool addLimit (const QString &LimitId, const Limit &limit)
 Add a limit line to the plot.
 
void removeLimit (const QString &LimitID)
 Remove a limit line from the plot.
 
void clearLimits ()
 Remove all limit lines from the plot.
 
QMap< QString, LimitgetLimits () const
 Get all defined limits.
 
bool updateLimit (const QString &limitId, const Limit &limit)
 Update an existing limit line.
 
QCustomPlotcustomPlot () const
 Access the underlying QCustomPlot widget.
 
AxisSettings getSettings () const
 Get current axis settings.
 
void setSettings (const AxisSettings &settings)
 Apply axis settings to the plot.
 

Public Attributes

QLabel * xAxisLabel
 x-axis label
 

Detailed Description

Widget for displaying rectangular (Cartesian) plots with dual y-axes It provides a rectangular plot visualization with support for multiple traces, frequency-based markers, limit lines, and independent left/right y-axes.

Note
Features include axis locking, auto-scaling, and configurable frequency units.

Constructor & Destructor Documentation

◆ RectangularPlotWidget()

RectangularPlotWidget::RectangularPlotWidget ( QWidget *  parent = nullptr)
explicit

Class constructor.

Parameters
parentParent widget

Member Function Documentation

◆ addLimit()

bool RectangularPlotWidget::addLimit ( const QString &  LimitId,
const Limit limit 
)

Add a limit line to the plot.

Parameters
LimitIdLimit identifier
limitLimit line properties
Returns
true if added successfully, false if limit already exists

◆ addMarker()

bool RectangularPlotWidget::addMarker ( const QString &  markerId,
double  frequency,
const QPen &  pen = QPen(Qt::red, 2) 
)

Add a vertical marker at a specific frequency.

Parameters
markerIdUnique marker identifier
frequencyFrequency in Hz
penMarker line style (default: red, width 2)
Returns
true if added successfully, false if marker exists or frequency out of range

◆ addTrace()

void RectangularPlotWidget::addTrace ( const QString &  name,
const Trace trace 
)

Add or update a trace on the plot.

Parameters
nameUnique trace identifier
traceTrace data structure

◆ areAxisSettingsLocked()

bool RectangularPlotWidget::areAxisSettingsLocked ( ) const
inline

Check if axis settings are locked.

Returns
true if axes are locked and won't auto-adjust

◆ calculateNiceStep()

double RectangularPlotWidget::calculateNiceStep ( double  range)

Calculate an aesthetically pleasing step size for axis divisions.

Parameters
rangeThe range to divide
Returns
Nice step value (1, 2, 5, 10, etc. × power of 10)

◆ change_X_axis_title()

void RectangularPlotWidget::change_X_axis_title ( QString  title)
inline

Set X-axis title.

Parameters
titleNew title text

◆ change_Y2_axis_title()

void RectangularPlotWidget::change_Y2_axis_title ( QString  title)
inline

Set right Y-axis title.

Parameters
titleNew title text

◆ change_Y2_axis_units()

void RectangularPlotWidget::change_Y2_axis_units ( QString  units)
inline

Set right Y-axis unit label.

Parameters
unitsNew unit text

◆ change_Y_axis_title()

void RectangularPlotWidget::change_Y_axis_title ( QString  title)
inline

Set left Y-axis title.

Parameters
titleNew title text

◆ change_Y_axis_units()

void RectangularPlotWidget::change_Y_axis_units ( QString  units)
inline

Set left Y-axis unit label.

Parameters
unitsNew unit text

◆ customPlot()

QCustomPlot * RectangularPlotWidget::customPlot ( ) const
inline

Access the underlying QCustomPlot widget.

Returns
Pointer to the QCustomPlot instance

◆ getFreqIndex()

int RectangularPlotWidget::getFreqIndex ( )
inline

Get frequency unit combo box index.

Returns
Current frequency unit index

◆ getLimits()

QMap< QString, Limit > RectangularPlotWidget::getLimits ( ) const
inline

Get all defined limits.

Returns
Map of limit IDs to limit properties

◆ getMarkers()

QMap< QString, double > RectangularPlotWidget::getMarkers ( ) const

Get all markers and their frequencies.

Returns
Map of marker IDs to frequencies in Hz

◆ getSettings()

RectangularPlotWidget::AxisSettings RectangularPlotWidget::getSettings ( ) const

Get current axis settings.

Returns
AxisSettings structure with all current configurations

◆ getTracePen()

QPen RectangularPlotWidget::getTracePen ( const QString &  traceName) const

Get the pen style for a specific trace.

Parameters
traceNameName of the trace
Returns
QPen for the trace, or default pen if not found

◆ getTracesInfo()

QMap< QString, QPen > RectangularPlotWidget::getTracesInfo ( ) const

Get information about all traces.

Returns
Map of trace names to their pen styles

◆ getXscale()

double RectangularPlotWidget::getXscale ( )

Get frequency scale factor for current units.

Returns
Scale factor (1.0 for Hz, 1e-3 for kHz, 1e-6 for MHz, 1e-9 for GHz)

◆ getXunits()

QString RectangularPlotWidget::getXunits ( )
inline

Get current frequency unit string.

Returns
String containing current units (Hz, kHz, MHz, or GHz)

◆ isRightYAxisEnabled()

bool RectangularPlotWidget::isRightYAxisEnabled ( ) const
inline

Check if right Y-axis is enabled.

Returns
true if right Y-axis is visible

◆ removeLimit()

void RectangularPlotWidget::removeLimit ( const QString &  LimitID)

Remove a limit line from the plot.

Parameters
LimitIDLimit identifier

◆ removeMarker()

bool RectangularPlotWidget::removeMarker ( const QString &  markerId)

Remove a marker from the plot.

Parameters
markerIdMarker identifier
Returns
true if removed successfully, false if not found

◆ removeTrace()

void RectangularPlotWidget::removeTrace ( const QString &  name)
inline

Remove a trace from the plot.

Parameters
nameTrace identifier

◆ set_y_autoscale()

void RectangularPlotWidget::set_y_autoscale ( bool  value)
inline

Enable or disable automatic Y-axis scaling.

Parameters
valuetrue to enable auto-scaling, false to disable

◆ setRightYAxisEnabled()

void RectangularPlotWidget::setRightYAxisEnabled ( bool  enabled)

Enable or disable the right Y-axis.

Parameters
enabledtrue to show right Y-axis

◆ setSettings()

void RectangularPlotWidget::setSettings ( const AxisSettings settings)

Apply axis settings to the plot.

Parameters
settingsSettings structure to apply

◆ setTracePen()

void RectangularPlotWidget::setTracePen ( const QString &  traceName,
const QPen &  pen 
)

Set the pen style for a specific trace.

Parameters
traceNameName of the trace
penNew pen style

◆ setYdiv()

void RectangularPlotWidget::setYdiv ( double  val)
inline

Set left Y-axis division interval.

Parameters
valNew division value

◆ setYmax()

void RectangularPlotWidget::setYmax ( double  val)
inline

Set maximum left Y-axis value.

Parameters
valNew maximum value

◆ setYmin()

void RectangularPlotWidget::setYmin ( double  val)
inline

Set minimum left Y-axis value.

Parameters
valNew minimum value

◆ updateLimit()

bool RectangularPlotWidget::updateLimit ( const QString &  limitId,
const Limit limit 
)

Update an existing limit line.

Parameters
limitIdLimit identifier
limitNew limit properties
Returns
true if updated successfully, false if not found

◆ updateMarkerFrequency()

bool RectangularPlotWidget::updateMarkerFrequency ( const QString &  markerId,
double  newFrequency 
)

Update the frequency of an existing marker.

Parameters
markerIdMarker identifier
newFrequencyNew frequency in Hz
Returns
true if updated successfully, false if marker not found or frequency invali

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