PlotCanvas Class Reference

Plot canvas. More...

#include <PlotCanvas.hh>

Inherits QWidget.

Signals

void CanvasDeleted ()
 Qt signal to request self-deletion. More...
 

Public Member Functions

 PlotCanvas (QWidget *_parent)
 Constructor. More...
 
virtual ~PlotCanvas ()
 Destructor. More...
 
unsigned int AddPlot ()
 Add a new plot to the canvas. More...
 
unsigned int AddVariable (const std::string &_variable, const unsigned int _plotId=EmptyPlot)
 Add a new variable to a plot. More...
 
void Clear ()
 Clear the canvas and remove all variables and plots. More...
 
virtual bool eventFilter (QObject *_o, QEvent *_event)
 Used to filter scroll wheel events. More...
 
void Export (const std::string &_dirName, const FileType _type) const
 Export to PDF files in the given directory. More...
 
unsigned int PlotByVariable (const unsigned int _variableId) const
 Get the plot id which the variable is plotted in. More...
 
unsigned int PlotCount () const
 Get the number of plots in this canvas. More...
 
PlotCurveWeakPtr PlotCurve (const unsigned int _variableId)
 Get the curve associated with the variable. More...
 
std::vector< IncrementalPlot * > Plots () const
 Get all the plots in this canvas. More...
 
void RemovePlot (const unsigned int _plotId)
 Remove a plot from the canvas. More...
 
void RemoveVariable (const unsigned int _id, const unsigned int _plotId=EmptyPlot)
 Remove a variable from a plot. More...
 
void Restart ()
 Restart plotting. More...
 
void SetDeleteCanvasEnabled (const bool _enable)
 Set whether or not to enable the delete canvas option in settings. More...
 
void SetVariableLabel (const unsigned int _id, const std::string &_label)
 Set the label of a variable. More...
 
std::string Title () const
 Get the title of the plot. More...
 
void Update ()
 Update plots and curves with new data. More...
 
unsigned int VariableCount (const unsigned int _plotId) const
 Get the number of variables in a plot. More...
 

Static Public Attributes

static const unsigned int EmptyPlot
 Empty plot used to indicate non-existent plot. More...
 

Detailed Description

Plot canvas.

Constructor & Destructor Documentation

◆ PlotCanvas()

PlotCanvas ( QWidget *  _parent)
explicit

Constructor.

Parameters
[in]_parentPointer to the parent widget.

◆ ~PlotCanvas()

virtual ~PlotCanvas ( )
virtual

Destructor.

Member Function Documentation

◆ AddPlot()

unsigned int AddPlot ( )

Add a new plot to the canvas.

Returns
Unique id of the plot

◆ AddVariable()

unsigned int AddVariable ( const std::string &  _variable,
const unsigned int  _plotId = EmptyPlot 
)

Add a new variable to a plot.

Parameters
[in]_variableName of the variable.
[in]_plotIdUnique id of the plot to add the variable to.
Returns
Unique id of the variable

◆ CanvasDeleted

void CanvasDeleted ( )
signal

Qt signal to request self-deletion.

◆ Clear()

void Clear ( )

Clear the canvas and remove all variables and plots.

◆ eventFilter()

virtual bool eventFilter ( QObject *  _o,
QEvent *  _event 
)
virtual

Used to filter scroll wheel events.

Parameters
[in]_oObject that receives the event.
[in]_eventPointer to the event.
Returns
True if event was handled.

◆ Export()

void Export ( const std::string &  _dirName,
const FileType  _type 
) const

Export to PDF files in the given directory.

Parameters
[in]_dirNameName of the directory to save the files into.
[in]_typeFile type, such as PDFFile or CSVFile.

◆ PlotByVariable()

unsigned int PlotByVariable ( const unsigned int  _variableId) const

Get the plot id which the variable is plotted in.

Parameters
[in]_idUnique id of the variable
Returns
Unique id of the plot

◆ PlotCount()

unsigned int PlotCount ( ) const

Get the number of plots in this canvas.

Returns
Number of plots

◆ PlotCurve()

PlotCurveWeakPtr PlotCurve ( const unsigned int  _variableId)

Get the curve associated with the variable.

Parameters
[in]_idUnique id of the variable
Returns
A pointer to the PlotCurve object.

◆ Plots()

std::vector<IncrementalPlot *> Plots ( ) const

Get all the plots in this canvas.

Returns
A list of plots in this canvas.

◆ RemovePlot()

void RemovePlot ( const unsigned int  _plotId)

Remove a plot from the canvas.

Parameters
[in]_idUnique id of the plot

◆ RemoveVariable()

void RemoveVariable ( const unsigned int  _id,
const unsigned int  _plotId = EmptyPlot 
)

Remove a variable from a plot.

Parameters
[in]_idUnique id of the variable
[in]_plotIdUnique id of plot to remove the variable from. If EmptyPlot is specified, the function will search through all plots for the variable and remove it from the plot if found.

◆ Restart()

void Restart ( )

Restart plotting.

A new plot curve will be created for each variable in the plot. Existing plot curves will no longer be updated.

◆ SetDeleteCanvasEnabled()

void SetDeleteCanvasEnabled ( const bool  _enable)

Set whether or not to enable the delete canvas option in settings.

Parameters
[in]_enableTrue to enable delete canvas option

◆ SetVariableLabel()

void SetVariableLabel ( const unsigned int  _id,
const std::string &  _label 
)

Set the label of a variable.

Parameters
[in]_idUnique id of the variable
[in]_labelNew variable label.

◆ Title()

std::string Title ( ) const

Get the title of the plot.

Returns
Title of the plot

◆ Update()

void Update ( )

Update plots and curves with new data.

◆ VariableCount()

unsigned int VariableCount ( const unsigned int  _plotId) const

Get the number of variables in a plot.

Parameters
[in]_plotIdUnique plot id
Returns
Number of variables

Member Data Documentation

◆ EmptyPlot

const unsigned int EmptyPlot
static

Empty plot used to indicate non-existent plot.


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