cumbia-qtcontrols 1.x
Qt widgets on top of the cumbia C++ library
Public Slots | Signals | Public Member Functions | Properties | List of all members
QuSpectrumPlot Class Reference

Draw a line for each data source over time. More...

#include <quspectrumplot.h>

Inheritance diagram for QuSpectrumPlot:
Inheritance graph
[legend]

Public Slots

void setSource (const QString &s)
 
void setSources (const QStringList &l)
 
void ctxSwitch (CumbiaPool *cp, const CuControlsFactoryPool &fp)
 
void addSource (const QString &s)
 
void unsetSource (const QString &s)
 
void unsetSources ()
 
void setOptions (const CuData &options)
 
void setPeriod (int p)
 Changes the refresh period on the plot, issuing a setData on every reader with a CuData containing the "period" property set to p. More...
 
void requestLinkStats ()
 
- Public Slots inherited from QuPlotBase
virtual void refresh ()
 Calls updateMarkers, updateScales and replot, resetting the zoom base in the end. More...
 
void setXAxisAutoscaleEnabled (bool en, QwtPlot::Axis axis=QwtPlot::xBottom)
 
void setYAxisAutoscaleEnabled (bool en, QwtPlot::Axis axis=QwtPlot::yLeft)
 
void setXTopAxisAutoscaleEnabled (bool autoscale)
 
void setYRightAxisAutoscaleEnabled (bool autoscale)
 
void setYLowerBound (double l)
 
void setYUpperBound (double u)
 
void setXLowerBound (double l)
 
void setXUpperBound (double u)
 
void setXAutoscaleMargin (double d)
 
void setUpperBoundExtra (int axisId, double e)
 add some extra upper bound to the specified axis to optimize replot operations when the refresh rate is fast. More...
 
double upperBoundExtra (int axisId) const
 
double xAutoscaleMargin ()
 
void setYAutoscaleAdjustment (double d)
 
double yAutoscaleAdjustment ()
 
void setTitleOnCanvasEnabled (bool en)
 
void setCurveStyle (const QString &curveName, QwtPlotCurve::CurveStyle)
 
void setDataBufferSize (int b)
 
void setZoomDisabled (bool)
 
void clearPlot ()
 
virtual void setData (const QString &curveName, const QVector< double > &xData, const QVector< double > &yData)
 
virtual void setData (const QString &curveName, double *xData, double *yData, int size)
 
virtual void appendData (const QString &curveName, double x, double y)
 
virtual void insertData (const QString &curveName, double *xData, double *yData, int size, double default_y=0.0)
 insert data into the plot ordered by x values More...
 
void setRefreshTimeout (int millis)
 
void setDefaultBounds (double lb, double ub, Axis axisId=QwtPlot::yLeft)
 
void restoreDefaultBounds (Axis axisId=QwtPlot::yLeft)
 restores the bounds set with setDefaultBounds More...
 
void setAxisScaleDefaultEnabled (bool en, Axis axisId=QwtPlot::yLeft)
 Restores the bounds of axisId to their default values if en is true, does nothing if en is false. More...
 

Signals

void newData (const CuData &)
 
void linkStatsRequest (QWidget *myself, CuContextI *myself_as_cwi)
 
- Signals inherited from QuPlotBase
void plotClicked (const QPoint &pt, QwtPlotCurve *closestCurve, double x, double y, const QPoint &curvePoint)
 
void curveAdded (QuPlotCurve *)
 This signal is emitted when a new curve is added to the plot. More...
 
void curveRemoved (QuPlotCurve *)
 This signal is emitted whenever a curve is removed from the plot via removeCurve. More...
 
void markerTextChanged (const QString &yText, const QString &xText="", double x=0.0, double y=0.0)
 
void markerVisibilityChanged (bool visible)
 

Public Member Functions

 QuSpectrumPlot (QWidget *w, Cumbia *cumbia, const CuControlsReaderFactoryI &r_fac)
 Constructor with the parent widget, an engine specific Cumbia implementation and a CuControlsReaderFactoryI interface. More...
 
 QuSpectrumPlot (QWidget *w, CumbiaPool *cumbia_pool, const CuControlsFactoryPool &fpool)
 Constructor with the parent widget, CumbiaPool and CuControlsFactoryPool More...
 
virtual ~QuSpectrumPlot ()
 
QString source () const
 
QStringList sources () const
 
int period () const
 Get the refresh period of the sources issuing a getData on the first reader in the list. More...
 
CuContextgetContext () const
 Return a reference to the CuContext in use. More...
 
void onUpdate (const CuData &d)
 
void update (const CuData &d)
 
- Public Member Functions inherited from QuPlotBase
 QuPlotBase (QWidget *parent)
 The constructor of a simple plot with zooming and scrolling capabilities. More...
 
 QuPlotBase (const QwtText &title, QWidget *parent)
 The constructor of a simple plot with zooming and scrolling capabilities. More...
 
virtual ~QuPlotBase ()
 
CurveStyle curvesStyle ()
 
bool titleOnCanvasEnabled ()
 
bool xAxisAutoscaleEnabled (QwtPlot::Axis axis=QwtPlot::xBottom)
 
bool yAxisAutoscaleEnabled (QwtPlot::Axis axis=QwtPlot::yLeft)
 
double yUpperBound (QwtPlot::Axis axis=QwtPlot::yLeft)
 
double yLowerBound (QwtPlot::Axis axis=QwtPlot::yLeft)
 
double xUpperBound (QwtPlot::Axis axis=QwtPlot::xBottom)
 
double xLowerBound (QwtPlot::Axis axis=QwtPlot::xBottom)
 
double defaultLowerBound (QwtPlot::Axis axisId=QwtPlot::yLeft) const
 
double defaultUpperBound (QwtPlot::Axis axisId=QwtPlot::yLeft) const
 
bool xAxisLogScale (QwtPlot::Axis axis=QwtPlot::xBottom)
 
bool yAxisLogScale (QwtPlot::Axis axis=QwtPlot::yLeft)
 
void setXAxisLogScale (bool l, QwtPlot::Axis axis=QwtPlot::xBottom)
 
void setYAxisLogScale (bool l, QwtPlot::Axis axis=QwtPlot::yLeft)
 
bool zoomDisabled () const
 returns false if the zoom is enabled (the default), true otherwise. More...
 
QList< QwtPlotCurve * > curves () const
 
void addCurve (const QString &curveName, QuPlotCurve *curve)
 
void removeCurve (const QString &curveName)
 Removes the specified curve from the plot, deleting it. More...
 
void addCurve (const QString &curveName)
 
QuPlotCurvecurve (const QString &name)
 
int dataBufferSize ()
 returns the data buffer size. More...
 
void hideMarker ()
 
void appendData (const QString &curveName, double *x, double *y, int size)
 
int refreshTimeout () const
 
void update (const CuData &)
 
void configure (const CuData &da)
 
void setUpdateStrategy (QuWidgetUpdateStrategyI *updateStrategy)
 sets or replaces the update strategy (see the strategy design pattern) More...
 
void setContextMenuStrategy (QuWidgetContextMenuStrategyI *ctx_menu_strategy)
 sets or replaces the context menu strategy (see the strategy design pattern) More...
 
QuWidgetUpdateStrategyIupdateStrategy () const
 return the QuWidgetUpdateStrategyI implementation in use. More...
 
QuWidgetContextMenuStrategyIcontextMenuStrategy () const
 return the QuWidgetContextMenuStrategyI implementation in use. More...
 
virtual QDialog * createConfigureDialog ()
 
virtual bool updateMarker ()
 updates the marker, if visible, and returns true if it's visible, false otherwise More...
 
virtual bool updateScales ()
 Updates the axes bounds for which autoscale is enabled. More...
 
void resetZoom ()
 
bool inZoom () const
 
QuPlotComponentgetComponent (const QString &name) const
 returns the QuPlotComponent corresponding to the given name, nullptr if name is not valid More...
 
void registerComponent (QuPlotComponent *, const QString &name)
 
QuPlotComponentunregisterComponent (const QString &name)
 QuPlotBase::unregisterComponent unregister the component with the given name. More...
 
- Public Member Functions inherited from QuWidgetInterface
virtual ~QuWidgetInterface ()
 
virtual void update (const CuData &d)=0
 
virtual void setUpdateStrategy (QuWidgetUpdateStrategyI *updateStrategy)=0
 
virtual void setContextMenuStrategy (QuWidgetContextMenuStrategyI *ctx_menu_strategy)=0
 
- Public Member Functions inherited from CuContextI
virtual ~CuContextI ()
 
virtual CuContextgetContext () const =0
 Return a reference to the CuContext in use. More...
 

Properties

QStringList sources
 
QString source
 
int period
 
- Properties inherited from QuPlotBase
bool xAxisAutoscale
 
bool yAxisAutoscale
 
double yUpperBound
 
double yLowerBound
 
double xUpperBound
 
double xLowerBound
 
double xAutoscaleMargin
 
double yAutoscaleAdjustment
 
bool titleOnCanvasEnabled
 
bool yAxisLogScale
 
bool zoomDisabled
 
int dataBufferSize
 
int refreshTimeout
 

Additional Inherited Members

- Public Types inherited from QuPlotBase
enum  CurveStyle {
  NoCurve , Lines , Sticks , Steps ,
  Dots , UserCurve = 100
}
 
- Protected Slots inherited from QuPlotBase
void displayZoomHint ()
 
void eraseZoomHint ()
 
void plotZoomed (const QRectF &)
 
void showMarker (const QPolygon &p)
 
void print ()
 
void snapshot ()
 
void copyImage ()
 
virtual void configurePlot ()
 
void saveData ()
 dumps the curves into a csv file. More...
 
- Protected Member Functions inherited from QuPlotBase
virtual QString plotTitle ()
 returns the plot title. More...
 
virtual void drawCanvas (QPainter *p)
 
void mouseReleaseEvent (QMouseEvent *ev)
 
void keyPressEvent (QKeyEvent *ke)
 
void moveCurveToYRight (QwtPlotCurve *c, bool yr)
 
virtual void init ()
 
void contextMenuEvent (QContextMenuEvent *)
 QuPlotBase::contextMenuEvent executes a contextual menu when the plot is right clicked. More...
 
void us_to_ms (std::vector< double > &ts_us) const
 convert input vector of timestamps in microseconds to a vector of timestamps in milliseconds More...
 

Detailed Description

Draw a line for each data source over time.

QuSpectrumPlot is designed to accept a list of data sources. Each data source is represented by a curve in the plot, which is updated according to the CuData "value" and "timestamp_ms" properties. If CuData "err" boolean is true or the "value" data format is not a scalar, the plot is disabled.

Plot update strategies.
Any implementation-specific data update is delegated to an update strategy through setUpdateStrategy. If no update strategy is set, then the update method is called from within onUpdate and the base operations aforementioned are performed. Strategies must implement QuWidgetUpdateStrategyI interface.

Constructor & Destructor Documentation

◆ QuSpectrumPlot() [1/2]

QuSpectrumPlot::QuSpectrumPlot ( QWidget *  w,
Cumbia *  cumbia,
const CuControlsReaderFactoryI r_fac 
)

Constructor with the parent widget, an engine specific Cumbia implementation and a CuControlsReaderFactoryI interface.

Please refer to md_src_cumbia_qtcontrols_widget_constructors documentation.

◆ QuSpectrumPlot() [2/2]

QuSpectrumPlot::QuSpectrumPlot ( QWidget *  w,
CumbiaPool *  cumbia_pool,
const CuControlsFactoryPool fpool 
)

Constructor with the parent widget, CumbiaPool and CuControlsFactoryPool

Please refer to md_src_cumbia_qtcontrols_widget_constructors documentation.

◆ ~QuSpectrumPlot()

QuSpectrumPlot::~QuSpectrumPlot ( )
virtual

Member Function Documentation

◆ addSource

void QuSpectrumPlot::addSource ( const QString &  s)
slot

◆ ctxSwitch

void QuSpectrumPlot::ctxSwitch ( CumbiaPool *  cp,
const CuControlsFactoryPool fp 
)
slot

◆ getContext()

CuContext * QuSpectrumPlot::getContext ( ) const
virtual

Return a reference to the CuContext in use.

Returns
a pointer to the CuContext used by the subclass.

Implements CuContextI.

Referenced by unsetSources().

◆ linkStatsRequest

void QuSpectrumPlot::linkStatsRequest ( QWidget *  myself,
CuContextI myself_as_cwi 
)
signal

Referenced by requestLinkStats().

◆ newData

void QuSpectrumPlot::newData ( const CuData &  )
signal

Referenced by onUpdate().

◆ onUpdate()

void QuSpectrumPlot::onUpdate ( const CuData &  d)

◆ period()

int QuSpectrumPlot::period ( ) const

Get the refresh period of the sources issuing a getData on the first reader in the list.

Note 1
The effective period of the reader is returned, not the "period" property stored in the CuData options.
Note 2
If each source has been configured with different periods, you should call getContext()->getData with a list of CuData as parameter.

◆ requestLinkStats

void QuSpectrumPlot::requestLinkStats ( )
slot

References linkStatsRequest().

◆ setOptions

void QuSpectrumPlot::setOptions ( const CuData &  options)
slot

◆ setPeriod

void QuSpectrumPlot::setPeriod ( int  p)
slot

Changes the refresh period on the plot, issuing a setData on every reader with a CuData containing the "period" property set to p.

QuContext options are left unchanged.

Note
The effect on the refresh period of the sources depends on the CuControlsReaderA implementation. For example, in the context of the Tango control system, you should expect that a reader managed by events is not affected by a period change.

◆ setSource

void QuSpectrumPlot::setSource ( const QString &  s)
slot

References setSources(), and unsetSources().

◆ setSources

void QuSpectrumPlot::setSources ( const QStringList &  l)
slot

References unsetSources().

Referenced by setSource().

◆ source()

QString QuSpectrumPlot::source ( ) const

References sources.

◆ sources()

QStringList QuSpectrumPlot::sources ( ) const

◆ unsetSource

void QuSpectrumPlot::unsetSource ( const QString &  s)
slot

◆ unsetSources

void QuSpectrumPlot::unsetSources ( )
slot

◆ update()

void QuSpectrumPlot::update ( const CuData &  d)
virtual

Property Documentation

◆ period

int QuSpectrumPlot::period
readwrite

◆ source

QString QuSpectrumPlot::source
readwrite

◆ sources

QStringList QuSpectrumPlot::sources
readwrite

Referenced by source().


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