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 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, float value, Qt::Orientation orientation=Qt::Horizontal)
 
bool contains (const QString &curveName)
 
QStringList curveNames ()
 
QPen getRandomPenColored ()
 
void keepAllData (bool kept)
 
void removeCurves ()
 
QRectF sceneRect () const
 
void setFixedXAxis (float x1, float x2)
 
void setFixedYAxis (float y1, float 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
 
 UPlot (QWidget *parent=0)
 
virtual ~UPlot ()
 

Protected Member Functions

virtual void contextMenuEvent (QContextMenuEvent *event)
 
virtual void paintEvent (QPaintEvent *event)
 
virtual void resizeEvent (QResizeEvent *event)
 

Private Slots

void captureScreen ()
 
void updateAxis (const UPlotCurve *curve)
 

Private Member Functions

void addItem (QGraphicsItem *item)
 
void createActions ()
 
void createMenus ()
 
void replot (QPainter *painter)
 
void selectScreenCaptureFormat ()
 
void setupUi ()
 
bool updateAxis (float x, float y)
 
bool updateAxis (float x1, float x2, float y1, float y2)
 

Private Attributes

QAction * _aAddHorizontalLine
 
QAction * _aAddVerticalLine
 
QAction * _aAutoScreenCapture
 
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 * _aSaveFigure
 
QAction * _aShowGrid
 
QAction * _aShowLegend
 
QAction * _aShowRefreshRate
 
QString _autoScreenCaptureFormat
 
float _axisMaximums [4]
 
bool _axisMaximumsSet [4]
 
QAction * _aYLabelVertical
 
QList< UPlotCurve * > _curves
 
bool _fixedAxis [2]
 
QWidget * _graphicsViewHolder
 
UPlotAxis_horizontalAxis
 
UPlotLegend_legend
 
int _lowestRefreshRate
 
int _maxVisibleItems
 
QMenu * _menu
 
int _penStyleCount
 
QTime _refreshIntervalTime
 
QLabel * _refreshRate
 
QTime _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.

UPlot.gif
UPlotMenu.png

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");
float y[10] = {0, 1, 2, 3, -3, -2, -1, 0, 1, 2};
curve->addValues(std::vector<float>(y, y+10));
plot.showGrid(true);
plot.setGraphicsView(true);
plot.show();
app.exec();
return 0;
}
SimplePlot.tiff

Definition at line 462 of file UPlot.h.

Constructor & Destructor Documentation

UPlot::UPlot ( QWidget *  parent = 0)

Constructor.

Definition at line 1543 of file UPlot.cpp.

UPlot::~UPlot ( )
virtual

Definition at line 1578 of file UPlot.cpp.

Member Function Documentation

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 1724 of file UPlot.cpp.

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

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

Definition at line 1740 of file UPlot.cpp.

void UPlot::addItem ( QGraphicsItem *  item)
private

Definition at line 2420 of file UPlot.cpp.

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

Add a threshold to the plot.

Definition at line 2365 of file UPlot.cpp.

void UPlot::captureScreen ( )
privateslot

Definition at line 2314 of file UPlot.cpp.

void UPlot::clearData ( )
slot

Clear all curves' data.

Definition at line 2351 of file UPlot.cpp.

bool UPlot::contains ( const QString &  curveName)

Definition at line 1797 of file UPlot.cpp.

void UPlot::contextMenuEvent ( QContextMenuEvent *  event)
protectedvirtual

Definition at line 2107 of file UPlot.cpp.

void UPlot::createActions ( )
private

Definition at line 1640 of file UPlot.cpp.

void UPlot::createMenus ( )
private

Definition at line 1691 of file UPlot.cpp.

QStringList UPlot::curveNames ( )

Get all curve names.

Definition at line 1784 of file UPlot.cpp.

QPen UPlot::getRandomPenColored ( )

Definition at line 1809 of file UPlot.cpp.

void UPlot::keepAllData ( bool  kept)

Definition at line 2460 of file UPlot.cpp.

void UPlot::paintEvent ( QPaintEvent *  event)
protectedvirtual

Definition at line 2075 of file UPlot.cpp.

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 2516 of file UPlot.cpp.

void UPlot::removeCurves ( )

Definition at line 2506 of file UPlot.cpp.

void UPlot::replot ( QPainter *  painter)
private

Definition at line 1814 of file UPlot.cpp.

void UPlot::resizeEvent ( QResizeEvent *  event)
protectedvirtual

Definition at line 2098 of file UPlot.cpp.

QRectF UPlot::sceneRect ( ) const

Definition at line 2501 of file UPlot.cpp.

void UPlot::selectScreenCaptureFormat ( )
private

Definition at line 2338 of file UPlot.cpp.

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

Definition at line 1969 of file UPlot.cpp.

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

Definition at line 1976 of file UPlot.cpp.

void UPlot::setGraphicsView ( bool  on)

Definition at line 2453 of file UPlot.cpp.

void UPlot::setMaxVisibleItems ( int  maxVisibleItems)

Definition at line 2465 of file UPlot.cpp.

void UPlot::setTitle ( const QString &  text)

Definition at line 2385 of file UPlot.cpp.

void UPlot::setupUi ( )
private

Definition at line 1587 of file UPlot.cpp.

void UPlot::setVariableXAxis ( )
inline

Definition at line 499 of file UPlot.h.

void UPlot::setVariableYAxis ( )
inline

Definition at line 500 of file UPlot.h.

void UPlot::setWorkingDirectory ( const QString &  workingDirectory)

Definition at line 2302 of file UPlot.cpp.

void UPlot::setXLabel ( const QString &  text)

Definition at line 2396 of file UPlot.cpp.

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

Definition at line 2407 of file UPlot.cpp.

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

Definition at line 2550 of file UPlot.cpp.

void UPlot::showGrid ( bool  shown)

Definition at line 2436 of file UPlot.cpp.

void UPlot::showLegend ( bool  shown)

Definition at line 2425 of file UPlot.cpp.

void UPlot::showRefreshRate ( bool  shown)

Definition at line 2442 of file UPlot.cpp.

void UPlot::showXAxis ( bool  shown)
inline

Definition at line 497 of file UPlot.h.

void UPlot::showYAxis ( bool  shown)
inline

Definition at line 498 of file UPlot.h.

QString UPlot::title ( ) const
inline

Definition at line 491 of file UPlot.h.

void UPlot::updateAxis ( )
slot

Definition at line 2049 of file UPlot.cpp.

void UPlot::updateAxis ( const UPlotCurve curve)
privateslot

Definition at line 1983 of file UPlot.cpp.

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

Definition at line 2014 of file UPlot.cpp.

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

Definition at line 1999 of file UPlot.cpp.

Friends And Related Function Documentation

friend class UPlotCurve
friend

Definition at line 535 of file UPlot.h.

Member Data Documentation

QAction* UPlot::_aAddHorizontalLine
private

Definition at line 584 of file UPlot.h.

QAction* UPlot::_aAddVerticalLine
private

Definition at line 583 of file UPlot.h.

QAction* UPlot::_aAutoScreenCapture
private

Definition at line 591 of file UPlot.h.

QAction* UPlot::_aChangeTitle
private

Definition at line 585 of file UPlot.h.

QAction* UPlot::_aChangeXLabel
private

Definition at line 586 of file UPlot.h.

QAction* UPlot::_aChangeYLabel
private

Definition at line 587 of file UPlot.h.

QAction* UPlot::_aClearData
private

Definition at line 592 of file UPlot.h.

QAction* UPlot::_aGraphicsView
private

Definition at line 593 of file UPlot.h.

QAction* UPlot::_aKeepAllData
private

Definition at line 575 of file UPlot.h.

QAction* UPlot::_aLimit0
private

Definition at line 576 of file UPlot.h.

QAction* UPlot::_aLimit10
private

Definition at line 577 of file UPlot.h.

QAction* UPlot::_aLimit100
private

Definition at line 579 of file UPlot.h.

QAction* UPlot::_aLimit1000
private

Definition at line 581 of file UPlot.h.

QAction* UPlot::_aLimit50
private

Definition at line 578 of file UPlot.h.

QAction* UPlot::_aLimit500
private

Definition at line 580 of file UPlot.h.

QAction* UPlot::_aLimitCustom
private

Definition at line 582 of file UPlot.h.

QAction* UPlot::_aSaveFigure
private

Definition at line 590 of file UPlot.h.

QAction* UPlot::_aShowGrid
private

Definition at line 574 of file UPlot.h.

QAction* UPlot::_aShowLegend
private

Definition at line 573 of file UPlot.h.

QAction* UPlot::_aShowRefreshRate
private

Definition at line 589 of file UPlot.h.

QString UPlot::_autoScreenCaptureFormat
private

Definition at line 570 of file UPlot.h.

float UPlot::_axisMaximums[4]
private

Definition at line 552 of file UPlot.h.

bool UPlot::_axisMaximumsSet[4]
private

Definition at line 553 of file UPlot.h.

QAction* UPlot::_aYLabelVertical
private

Definition at line 588 of file UPlot.h.

QList<UPlotCurve*> UPlot::_curves
private

Definition at line 561 of file UPlot.h.

bool UPlot::_fixedAxis[2]
private

Definition at line 554 of file UPlot.h.

QWidget* UPlot::_graphicsViewHolder
private

Definition at line 551 of file UPlot.h.

UPlotAxis* UPlot::_horizontalAxis
private

Definition at line 556 of file UPlot.h.

UPlotLegend* UPlot::_legend
private

Definition at line 548 of file UPlot.h.

int UPlot::_lowestRefreshRate
private

Definition at line 568 of file UPlot.h.

int UPlot::_maxVisibleItems
private

Definition at line 558 of file UPlot.h.

QMenu* UPlot::_menu
private

Definition at line 572 of file UPlot.h.

int UPlot::_penStyleCount
private

Definition at line 557 of file UPlot.h.

QTime UPlot::_refreshIntervalTime
private

Definition at line 567 of file UPlot.h.

QLabel* UPlot::_refreshRate
private

Definition at line 565 of file UPlot.h.

QTime UPlot::_refreshStartTime
private

Definition at line 569 of file UPlot.h.

QGraphicsItem* UPlot::_sceneRoot
private

Definition at line 550 of file UPlot.h.

QLabel* UPlot::_title
private

Definition at line 562 of file UPlot.h.

UPlotAxis* UPlot::_verticalAxis
private

Definition at line 555 of file UPlot.h.

QGraphicsView* UPlot::_view
private

Definition at line 549 of file UPlot.h.

QString UPlot::_workingDirectory
private

Definition at line 566 of file UPlot.h.

QLabel* UPlot::_xLabel
private

Definition at line 563 of file UPlot.h.

UOrientableLabel* UPlot::_yLabel
private

Definition at line 564 of file UPlot.h.

QList<QGraphicsLineItem *> UPlot::hGridLines
private

Definition at line 559 of file UPlot.h.

QList<QGraphicsLineItem *> UPlot::vGridLines
private

Definition at line 560 of file UPlot.h.


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


find_object_2d
Author(s): Mathieu Labbe
autogenerated on Mon Jun 10 2019 13:21:32