IncrementalPlot Class Reference

A plotting widget that handles incremental addition of data. More...

#include <IncrementalPlot.hh>

Inherits QwtPlot.

Public Types

enum  PlotAxis { X_BOTTOM_AXIS = 0, X_TOP_AXIS = 1, Y_LEFT_AXIS = 2, Y_RIGHT_AXIS = 3 }
 Axis enum. More...
 

Signals

void VariableAdded (const std::string &_name)
 Qt signal emitted when a variable pill is added. More...
 

Public Member Functions

 IncrementalPlot (QWidget *_parent=nullptr)
 Constructor. More...
 
virtual ~IncrementalPlot ()
 Destructor. More...
 
PlotCurveWeakPtr AddCurve (const std::string &_label)
 Add a named curve. More...
 
void AddPoint (const unsigned int _id, const ignition::math::Vector2d &_pt)
 Add a new point to a curve. More...
 
void AddPoints (const unsigned int _id, const std::vector< ignition::math::Vector2d > &_pts)
 Add new points to a curve. More...
 
void AttachCurve (PlotCurveWeakPtr _curve)
 Attach a curve to this plot. More...
 
void Clear ()
 Clear all points from the plot. More...
 
PlotCurveWeakPtr Curve (const std::string &_label) const
 Find a plot curve by name. More...
 
PlotCurveWeakPtr Curve (const unsigned int _id) const
 Find a plot curve by id. More...
 
std::vector< PlotCurveWeakPtrCurves () const
 Get all curves in this plot. More...
 
PlotCurvePtr DetachCurve (const unsigned int _id)
 Detach a curve from this plot. More...
 
bool IsShowGrid () const
 Get whether the grid lines are shown. More...
 
bool IsShowHoverLine () const
 Get whether the hover line is shown. More...
 
void RemoveCurve (const unsigned int _id)
 Remove a curve by id. More...
 
void SetCurveLabel (const unsigned int _id, const std::string &_label)
 Set a new label for the given curve. More...
 
void SetPeriod (const common::Time &_time)
 Set the period over which to plot. More...
 
void ShowAxisLabel (const PlotAxis _axis, const bool _show)
 Set whether to show the axis label. More...
 
void ShowGrid (const bool _show)
 Set whether to show the grid lines. More...
 
void ShowHoverLine (const bool _show)
 Set whether to show the hover line. More...
 
virtual QSize sizeHint () const
 Give QT a size hint. More...
 
void Update ()
 Update all the curves in the plot. More...
 

Protected Member Functions

void dragEnterEvent (QDragEnterEvent *_evt)
 Used to accept drag enter events. More...
 
void dropEvent (QDropEvent *_evt)
 Used to accept drop events. More...
 

Detailed Description

A plotting widget that handles incremental addition of data.

Member Enumeration Documentation

enum PlotAxis

Axis enum.

Enumerator
X_BOTTOM_AXIS 

bottom x axis

X_TOP_AXIS 

top x axis

Y_LEFT_AXIS 

left y axis

Y_RIGHT_AXIS 

right y axis

Constructor & Destructor Documentation

IncrementalPlot ( QWidget *  _parent = nullptr)
explicit

Constructor.

Parameters
[in]_parentPointer to a parent widget
virtual ~IncrementalPlot ( )
virtual

Destructor.

Member Function Documentation

PlotCurveWeakPtr AddCurve ( const std::string &  _label)

Add a named curve.

Parameters
[in]_labelName of the curve.
Returns
A pointer to the new curve.
void AddPoint ( const unsigned int  _id,
const ignition::math::Vector2d &  _pt 
)

Add a new point to a curve.

Parameters
[in]_idUnique id of the curve
[in]_ptPoint to add.
void AddPoints ( const unsigned int  _id,
const std::vector< ignition::math::Vector2d > &  _pts 
)

Add new points to a curve.

Parameters
[in]_idUnique id of the curve
[in]_ptPoints to add.
void AttachCurve ( PlotCurveWeakPtr  _curve)

Attach a curve to this plot.

Parameters
[in]_plotCurveThe curve to attach to the plot.
void Clear ( )

Clear all points from the plot.

PlotCurveWeakPtr Curve ( const std::string &  _label) const

Find a plot curve by name.

Parameters
[in]_labelName of the curve to look for.
Returns
Plot curve if found, nullptr otherwise.
PlotCurveWeakPtr Curve ( const unsigned int  _id) const

Find a plot curve by id.

Parameters
[in]_idUnique id of the plot curve.
Returns
Plot curve if found, nullptr otherwise.
std::vector<PlotCurveWeakPtr> Curves ( ) const

Get all curves in this plot.

Returns
A list of curves in this plot.
PlotCurvePtr DetachCurve ( const unsigned int  _id)

Detach a curve from this plot.

Parameters
[in]_idUnique id of the plot curve to detach.
Returns
Pointer to the plot curve
void dragEnterEvent ( QDragEnterEvent *  _evt)
protected

Used to accept drag enter events.

Parameters
[in]_evtThe drag event.
void dropEvent ( QDropEvent *  _evt)
protected

Used to accept drop events.

Parameters
[in]_evtThe drop event.
bool IsShowGrid ( ) const

Get whether the grid lines are shown.

Returns
True if the grid lines are visible.
bool IsShowHoverLine ( ) const

Get whether the hover line is shown.

Returns
True if the hover line is visible.
void RemoveCurve ( const unsigned int  _id)

Remove a curve by id.

Parameters
[in]_idUnique id of the curve.
void SetCurveLabel ( const unsigned int  _id,
const std::string &  _label 
)

Set a new label for the given curve.

Parameters
[in]_idUnique id of the plot curve
[in]_labelNew label to set the plot curve to.
void SetPeriod ( const common::Time _time)

Set the period over which to plot.

Parameters
[in]_timePeriod duration in seconds.
void ShowAxisLabel ( const PlotAxis  _axis,
const bool  _show 
)

Set whether to show the axis label.

Parameters
[in]_axisPlot axis: X_BOTTOM_AXIS or Y_LEFT_AXIS.
[in]_showTrue to show the label, false to hide it.
void ShowGrid ( const bool  _show)

Set whether to show the grid lines.

Parameters
[in]_showTrue to show grid lines.
void ShowHoverLine ( const bool  _show)

Set whether to show the hover line.

Parameters
[in]_showTrue to show hover line.
virtual QSize sizeHint ( ) const
virtual

Give QT a size hint.

Returns
Default size of the plot.
void Update ( )

Update all the curves in the plot.

void VariableAdded ( const std::string &  _name)
signal

Qt signal emitted when a variable pill is added.

Parameters
[in]_nameName of variable pill added.

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