Public Slots | Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | Friends | List of all members
UPlot Class Reference

#include <UPlot.h>

Inheritance diagram for UPlot:
Inheritance graph
[legend]

Public Slots

void clearData ()
 
void frameData (bool xAxis=true, bool yAxis=false)
 
void removeCurve (const UPlotCurve *curve)
 
void showCurve (const UPlotCurve *curve, bool shown)
 
void updateAxis ()
 

Public Member Functions

UPlotCurveaddCurve (const QString &curveName, const QColor &color=QColor())
 
bool addCurve (UPlotCurve *curve, bool ownershipTransferred=true)
 
UPlotCurveThresholdaddThreshold (const QString &name, qreal value, Qt::Orientation orientation=Qt::Horizontal)
 
bool contains (const QString &curveName) const
 
QStringList curveNames () const
 
QString getAllCurveDataAsText () const
 
QPen getRandomPenColored ()
 
double getThresholdValue (const QString &curveName) const
 
bool isThreshold (const QString &curveName) const
 
void keepAllData (bool kept)
 
void removeCurves ()
 
QRectF sceneRect () const
 
void setBackgroundColor (const QColor &color)
 
void setFixedXAxis (qreal x1, qreal x2)
 
void setFixedYAxis (qreal y1, qreal y2)
 
void setGraphicsView (bool on)
 
void setMaxVisibleItems (int maxVisibleItems)
 
void setTitle (const QString &text)
 
void setVariableXAxis ()
 
void setVariableYAxis ()
 
void setWorkingDirectory (const QString &workingDirectory)
 
void setXLabel (const QString &text)
 
void setYLabel (const QString &text, Qt::Orientation orientation=Qt::Vertical)
 
void showGrid (bool shown)
 
void showLegend (bool shown)
 
void showRefreshRate (bool shown)
 
void showXAxis (bool shown)
 
void showYAxis (bool shown)
 
QString title () const
 
void trackMouse (bool tracking)
 
 UPlot (QWidget *parent=0)
 
virtual ~UPlot ()
 

Protected Member Functions

virtual void contextMenuEvent (QContextMenuEvent *event)
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 
virtual void mouseMoveEvent (QMouseEvent *event)
 
virtual void mousePressEvent (QMouseEvent *event)
 
virtual void mouseReleaseEvent (QMouseEvent *event)
 
virtual void paintEvent (QPaintEvent *event)
 
virtual void resizeEvent (QResizeEvent *event)
 

Private Slots

void captureScreen ()
 
void moveCurve (const UPlotCurve *, int index)
 
void updateAxis (const UPlotCurve *curve)
 

Private Member Functions

void addItem (QGraphicsItem *item)
 
void createActions ()
 
void createMenus ()
 
bool mousePosToValue (const QPoint &pos, qreal &x, qreal &y)
 
void replot (QPainter *painter)
 
void selectScreenCaptureFormat ()
 
void setupUi ()
 
bool updateAxis (qreal x, qreal y)
 
bool updateAxis (qreal x1, qreal x2, qreal y1, qreal y2)
 

Private Attributes

QAction * _aAddHorizontalLine
 
QAction * _aAddVerticalLine
 
QAction * _aAutoScreenCapture
 
QAction * _aChangeBackgroundColor
 
QAction * _aChangeTitle
 
QAction * _aChangeXLabel
 
QAction * _aChangeYLabel
 
QAction * _aClearData
 
QAction * _aGraphicsView
 
QAction * _aKeepAllData
 
QAction * _aLimit0
 
QAction * _aLimit10
 
QAction * _aLimit100
 
QAction * _aLimit1000
 
QAction * _aLimit50
 
QAction * _aLimit500
 
QAction * _aLimitCustom
 
QAction * _aMouseTracking
 
QAction * _aSaveFigure
 
QAction * _aShowGrid
 
QAction * _aShowLegend
 
QAction * _aShowRefreshRate
 
QString _autoScreenCaptureFormat
 
qreal _axisMaximums [4]
 
bool _axisMaximumsSet [4]
 
QAction * _aYLabelVertical
 
QColor _bgColor
 
QList< UPlotCurve * > _curves
 
bool _fixedAxis [2]
 
QWidget * _graphicsViewHolder
 
UPlotAxis_horizontalAxis
 
UPlotLegend_legend
 
int _lowestRefreshRate
 
int _maxVisibleItems
 
QMenu * _menu
 
QPoint _mouseCurrentPos
 
QPoint _mousePressedPos
 
int _penStyleCount
 
QElapsedTimer _refreshIntervalTime
 
QLabel * _refreshRate
 
QElapsedTimer _refreshStartTime
 
QGraphicsItem * _sceneRoot
 
QLabel * _title
 
UPlotAxis_verticalAxis
 
QGraphicsView * _view
 
QString _workingDirectory
 
QLabel * _xLabel
 
UOrientableLabel_yLabel
 
QList< QGraphicsLineItem * > hGridLines
 
QList< QGraphicsLineItem * > vGridLines
 

Friends

class UPlotCurve
 

Detailed Description

UPlot is a QWidget to create a plot like MATLAB, and incrementally add new values like a scope using Qt signals/slots. Many customizations can be done at runtime with the right-click menu.

Example:

#include "utilite/UPlot.h"
#include <QApplication>
int main(int argc, char * argv[])
{
QApplication app(argc, argv);
UPlot plot;
UPlotCurve * curve = plot.addCurve("My curve");
qreal y[10] = {0, 1, 2, 3, -3, -2, -1, 0, 1, 2};
curve->addValues(std::vector<qreal>(y, y+10));
plot.showGrid(true);
plot.setGraphicsView(true);
plot.show();
app.exec();
return 0;
}

Definition at line 492 of file UPlot.h.

Constructor & Destructor Documentation

◆ UPlot()

UPlot::UPlot ( QWidget *  parent = 0)

Constructor.

Definition at line 1910 of file UPlot.cpp.

◆ ~UPlot()

UPlot::~UPlot ( )
virtual

Definition at line 1981 of file UPlot.cpp.

Member Function Documentation

◆ addCurve() [1/2]

UPlotCurve * UPlot::addCurve ( const QString &  curveName,
const QColor &  color = QColor() 
)

Add a curve. The returned curve doesn't need to be deallocated (UPlot keeps the ownership).

Definition at line 2134 of file UPlot.cpp.

◆ addCurve() [2/2]

bool UPlot::addCurve ( UPlotCurve curve,
bool  ownershipTransferred = true 
)

Add a curve. Ownership is transferred to UPlot if ownershipTransferred=true.

Definition at line 2150 of file UPlot.cpp.

◆ addItem()

void UPlot::addItem ( QGraphicsItem *  item)
private

Definition at line 3143 of file UPlot.cpp.

◆ addThreshold()

UPlotCurveThreshold * UPlot::addThreshold ( const QString &  name,
qreal  value,
Qt::Orientation  orientation = Qt::Horizontal 
)

Add a threshold to the plot.

Definition at line 3075 of file UPlot.cpp.

◆ captureScreen

void UPlot::captureScreen ( )
privateslot

Definition at line 2971 of file UPlot.cpp.

◆ clearData

void UPlot::clearData ( )
slot

Clear all curves' data.

Definition at line 3008 of file UPlot.cpp.

◆ contains()

bool UPlot::contains ( const QString &  curveName) const

Definition at line 2240 of file UPlot.cpp.

◆ contextMenuEvent()

void UPlot::contextMenuEvent ( QContextMenuEvent *  event)
protectedvirtual

Definition at line 2752 of file UPlot.cpp.

◆ createActions()

void UPlot::createActions ( )
private

Definition at line 2045 of file UPlot.cpp.

◆ createMenus()

void UPlot::createMenus ( )
private

Definition at line 2099 of file UPlot.cpp.

◆ curveNames()

QStringList UPlot::curveNames ( ) const

Get all curve names.

Definition at line 2198 of file UPlot.cpp.

◆ frameData

void UPlot::frameData ( bool  xAxis = true,
bool  yAxis = false 
)
slot

Definition at line 3021 of file UPlot.cpp.

◆ getAllCurveDataAsText()

QString UPlot::getAllCurveDataAsText ( ) const

Definition at line 3341 of file UPlot.cpp.

◆ getRandomPenColored()

QPen UPlot::getRandomPenColored ( )

Definition at line 2252 of file UPlot.cpp.

◆ getThresholdValue()

double UPlot::getThresholdValue ( const QString &  curveName) const

Definition at line 2223 of file UPlot.cpp.

◆ isThreshold()

bool UPlot::isThreshold ( const QString &  curveName) const

Definition at line 2211 of file UPlot.cpp.

◆ keepAllData()

void UPlot::keepAllData ( bool  kept)

Definition at line 3191 of file UPlot.cpp.

◆ mouseDoubleClickEvent()

void UPlot::mouseDoubleClickEvent ( QMouseEvent *  event)
protectedvirtual

Definition at line 2703 of file UPlot.cpp.

◆ mouseMoveEvent()

void UPlot::mouseMoveEvent ( QMouseEvent *  event)
protectedvirtual

Definition at line 2626 of file UPlot.cpp.

◆ mousePosToValue()

bool UPlot::mousePosToValue ( const QPoint &  pos,
qreal &  x,
qreal &  y 
)
private

Definition at line 2709 of file UPlot.cpp.

◆ mousePressEvent()

void UPlot::mousePressEvent ( QMouseEvent *  event)
protectedvirtual

Definition at line 2619 of file UPlot.cpp.

◆ mouseReleaseEvent()

void UPlot::mouseReleaseEvent ( QMouseEvent *  event)
protectedvirtual

Definition at line 2668 of file UPlot.cpp.

◆ moveCurve

void UPlot::moveCurve ( const UPlotCurve curve,
int  index 
)
privateslot

Definition at line 3295 of file UPlot.cpp.

◆ paintEvent()

void UPlot::paintEvent ( QPaintEvent *  event)
protectedvirtual

Definition at line 2554 of file UPlot.cpp.

◆ removeCurve

void UPlot::removeCurve ( const UPlotCurve curve)
slot

Remove a curve. If UPlot is the parent of the curve, the curve is deleted.

Definition at line 3247 of file UPlot.cpp.

◆ removeCurves()

void UPlot::removeCurves ( )

Definition at line 3237 of file UPlot.cpp.

◆ replot()

void UPlot::replot ( QPainter *  painter)
private

Definition at line 2279 of file UPlot.cpp.

◆ resizeEvent()

void UPlot::resizeEvent ( QResizeEvent *  event)
protectedvirtual

Definition at line 2610 of file UPlot.cpp.

◆ sceneRect()

QRectF UPlot::sceneRect ( ) const

Definition at line 3232 of file UPlot.cpp.

◆ selectScreenCaptureFormat()

void UPlot::selectScreenCaptureFormat ( )
private

Definition at line 2995 of file UPlot.cpp.

◆ setBackgroundColor()

void UPlot::setBackgroundColor ( const QColor &  color)

Definition at line 3130 of file UPlot.cpp.

◆ setFixedXAxis()

void UPlot::setFixedXAxis ( qreal  x1,
qreal  x2 
)

Definition at line 2448 of file UPlot.cpp.

◆ setFixedYAxis()

void UPlot::setFixedYAxis ( qreal  y1,
qreal  y2 
)

Definition at line 2455 of file UPlot.cpp.

◆ setGraphicsView()

void UPlot::setGraphicsView ( bool  on)

Definition at line 3183 of file UPlot.cpp.

◆ setMaxVisibleItems()

void UPlot::setMaxVisibleItems ( int  maxVisibleItems)

Definition at line 3196 of file UPlot.cpp.

◆ setTitle()

void UPlot::setTitle ( const QString &  text)

Definition at line 3095 of file UPlot.cpp.

◆ setupUi()

void UPlot::setupUi ( )
private

Definition at line 1990 of file UPlot.cpp.

◆ setVariableXAxis()

void UPlot::setVariableXAxis ( )
inline

Definition at line 533 of file UPlot.h.

◆ setVariableYAxis()

void UPlot::setVariableYAxis ( )
inline

Definition at line 534 of file UPlot.h.

◆ setWorkingDirectory()

void UPlot::setWorkingDirectory ( const QString &  workingDirectory)

Definition at line 2959 of file UPlot.cpp.

◆ setXLabel()

void UPlot::setXLabel ( const QString &  text)

Definition at line 3106 of file UPlot.cpp.

◆ setYLabel()

void UPlot::setYLabel ( const QString &  text,
Qt::Orientation  orientation = Qt::Vertical 
)

Definition at line 3117 of file UPlot.cpp.

◆ showCurve

void UPlot::showCurve ( const UPlotCurve curve,
bool  shown 
)
slot

Definition at line 3281 of file UPlot.cpp.

◆ showGrid()

void UPlot::showGrid ( bool  shown)

Definition at line 3160 of file UPlot.cpp.

◆ showLegend()

void UPlot::showLegend ( bool  shown)

Definition at line 3149 of file UPlot.cpp.

◆ showRefreshRate()

void UPlot::showRefreshRate ( bool  shown)

Definition at line 3166 of file UPlot.cpp.

◆ showXAxis()

void UPlot::showXAxis ( bool  shown)
inline

Definition at line 531 of file UPlot.h.

◆ showYAxis()

void UPlot::showYAxis ( bool  shown)
inline

Definition at line 532 of file UPlot.h.

◆ title()

QString UPlot::title ( ) const
inline

Definition at line 524 of file UPlot.h.

◆ trackMouse()

void UPlot::trackMouse ( bool  tracking)

Definition at line 3177 of file UPlot.cpp.

◆ updateAxis [1/4]

void UPlot::updateAxis ( )
slot

Definition at line 2528 of file UPlot.cpp.

◆ updateAxis [2/4]

void UPlot::updateAxis ( const UPlotCurve curve)
privateslot

Definition at line 2462 of file UPlot.cpp.

◆ updateAxis() [3/4]

bool UPlot::updateAxis ( qreal  x,
qreal  y 
)
private

Definition at line 2493 of file UPlot.cpp.

◆ updateAxis() [4/4]

bool UPlot::updateAxis ( qreal  x1,
qreal  x2,
qreal  y1,
qreal  y2 
)
private

Definition at line 2478 of file UPlot.cpp.

Friends And Related Function Documentation

◆ UPlotCurve

friend class UPlotCurve
friend

Definition at line 577 of file UPlot.h.

Member Data Documentation

◆ _aAddHorizontalLine

QAction* UPlot::_aAddHorizontalLine
private

Definition at line 630 of file UPlot.h.

◆ _aAddVerticalLine

QAction* UPlot::_aAddVerticalLine
private

Definition at line 629 of file UPlot.h.

◆ _aAutoScreenCapture

QAction* UPlot::_aAutoScreenCapture
private

Definition at line 639 of file UPlot.h.

◆ _aChangeBackgroundColor

QAction* UPlot::_aChangeBackgroundColor
private

Definition at line 634 of file UPlot.h.

◆ _aChangeTitle

QAction* UPlot::_aChangeTitle
private

Definition at line 631 of file UPlot.h.

◆ _aChangeXLabel

QAction* UPlot::_aChangeXLabel
private

Definition at line 632 of file UPlot.h.

◆ _aChangeYLabel

QAction* UPlot::_aChangeYLabel
private

Definition at line 633 of file UPlot.h.

◆ _aClearData

QAction* UPlot::_aClearData
private

Definition at line 640 of file UPlot.h.

◆ _aGraphicsView

QAction* UPlot::_aGraphicsView
private

Definition at line 641 of file UPlot.h.

◆ _aKeepAllData

QAction* UPlot::_aKeepAllData
private

Definition at line 621 of file UPlot.h.

◆ _aLimit0

QAction* UPlot::_aLimit0
private

Definition at line 622 of file UPlot.h.

◆ _aLimit10

QAction* UPlot::_aLimit10
private

Definition at line 623 of file UPlot.h.

◆ _aLimit100

QAction* UPlot::_aLimit100
private

Definition at line 625 of file UPlot.h.

◆ _aLimit1000

QAction* UPlot::_aLimit1000
private

Definition at line 627 of file UPlot.h.

◆ _aLimit50

QAction* UPlot::_aLimit50
private

Definition at line 624 of file UPlot.h.

◆ _aLimit500

QAction* UPlot::_aLimit500
private

Definition at line 626 of file UPlot.h.

◆ _aLimitCustom

QAction* UPlot::_aLimitCustom
private

Definition at line 628 of file UPlot.h.

◆ _aMouseTracking

QAction* UPlot::_aMouseTracking
private

Definition at line 637 of file UPlot.h.

◆ _aSaveFigure

QAction* UPlot::_aSaveFigure
private

Definition at line 638 of file UPlot.h.

◆ _aShowGrid

QAction* UPlot::_aShowGrid
private

Definition at line 620 of file UPlot.h.

◆ _aShowLegend

QAction* UPlot::_aShowLegend
private

Definition at line 619 of file UPlot.h.

◆ _aShowRefreshRate

QAction* UPlot::_aShowRefreshRate
private

Definition at line 636 of file UPlot.h.

◆ _autoScreenCaptureFormat

QString UPlot::_autoScreenCaptureFormat
private

Definition at line 613 of file UPlot.h.

◆ _axisMaximums

qreal UPlot::_axisMaximums[4]
private

Definition at line 595 of file UPlot.h.

◆ _axisMaximumsSet

bool UPlot::_axisMaximumsSet[4]
private

Definition at line 596 of file UPlot.h.

◆ _aYLabelVertical

QAction* UPlot::_aYLabelVertical
private

Definition at line 635 of file UPlot.h.

◆ _bgColor

QColor UPlot::_bgColor
private

Definition at line 616 of file UPlot.h.

◆ _curves

QList<UPlotCurve*> UPlot::_curves
private

Definition at line 604 of file UPlot.h.

◆ _fixedAxis

bool UPlot::_fixedAxis[2]
private

Definition at line 597 of file UPlot.h.

◆ _graphicsViewHolder

QWidget* UPlot::_graphicsViewHolder
private

Definition at line 594 of file UPlot.h.

◆ _horizontalAxis

UPlotAxis* UPlot::_horizontalAxis
private

Definition at line 599 of file UPlot.h.

◆ _legend

UPlotLegend* UPlot::_legend
private

Definition at line 591 of file UPlot.h.

◆ _lowestRefreshRate

int UPlot::_lowestRefreshRate
private

Definition at line 611 of file UPlot.h.

◆ _maxVisibleItems

int UPlot::_maxVisibleItems
private

Definition at line 601 of file UPlot.h.

◆ _menu

QMenu* UPlot::_menu
private

Definition at line 618 of file UPlot.h.

◆ _mouseCurrentPos

QPoint UPlot::_mouseCurrentPos
private

Definition at line 615 of file UPlot.h.

◆ _mousePressedPos

QPoint UPlot::_mousePressedPos
private

Definition at line 614 of file UPlot.h.

◆ _penStyleCount

int UPlot::_penStyleCount
private

Definition at line 600 of file UPlot.h.

◆ _refreshIntervalTime

QElapsedTimer UPlot::_refreshIntervalTime
private

Definition at line 610 of file UPlot.h.

◆ _refreshRate

QLabel* UPlot::_refreshRate
private

Definition at line 608 of file UPlot.h.

◆ _refreshStartTime

QElapsedTimer UPlot::_refreshStartTime
private

Definition at line 612 of file UPlot.h.

◆ _sceneRoot

QGraphicsItem* UPlot::_sceneRoot
private

Definition at line 593 of file UPlot.h.

◆ _title

QLabel* UPlot::_title
private

Definition at line 605 of file UPlot.h.

◆ _verticalAxis

UPlotAxis* UPlot::_verticalAxis
private

Definition at line 598 of file UPlot.h.

◆ _view

QGraphicsView* UPlot::_view
private

Definition at line 592 of file UPlot.h.

◆ _workingDirectory

QString UPlot::_workingDirectory
private

Definition at line 609 of file UPlot.h.

◆ _xLabel

QLabel* UPlot::_xLabel
private

Definition at line 606 of file UPlot.h.

◆ _yLabel

UOrientableLabel* UPlot::_yLabel
private

Definition at line 607 of file UPlot.h.

◆ hGridLines

QList<QGraphicsLineItem *> UPlot::hGridLines
private

Definition at line 602 of file UPlot.h.

◆ vGridLines

QList<QGraphicsLineItem *> UPlot::vGridLines
private

Definition at line 603 of file UPlot.h.


The documentation for this class was generated from the following files:
UPlot::showGrid
void showGrid(bool shown)
Definition: UPlot.cpp:3160
y
Matrix3f y
main
int main()
Definition: dummy.cpp:188
app
QApplication * app
Definition: tools/DataRecorder/main.cpp:59
UPlot::addCurve
UPlotCurve * addCurve(const QString &curveName, const QColor &color=QColor())
Definition: UPlot.cpp:2134
rtabmap_netvlad.argv
argv
Definition: rtabmap_netvlad.py:15
UPlot.h
UPlot::setGraphicsView
void setGraphicsView(bool on)
Definition: UPlot.cpp:3183
UPlotCurve
Definition: UPlot.h:93
UPlot
Definition: UPlot.h:492
UPlotCurve::addValues
void addValues(QVector< UPlotItem * > &data)
Definition: UPlot.cpp:478


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:26