#include <UPlot.h>
Public Slots | |
void | clearData () |
void | removeCurve (const UPlotCurve *curve) |
void | showCurve (const UPlotCurve *curve, bool shown) |
void | updateAxis () |
Public Member Functions | |
UPlotCurve * | addCurve (const QString &curveName, const QColor &color=QColor()) |
bool | addCurve (UPlotCurve *curve, bool ownershipTransferred=true) |
UPlotCurveThreshold * | addThreshold (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 |
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"); 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; }
UPlot::UPlot | ( | QWidget * | parent = 0 | ) |
UPlot::~UPlot | ( | ) | [virtual] |
UPlotCurve * UPlot::addCurve | ( | const QString & | curveName, |
const QColor & | color = QColor() |
||
) |
bool UPlot::addCurve | ( | UPlotCurve * | curve, |
bool | ownershipTransferred = true |
||
) |
void UPlot::addItem | ( | QGraphicsItem * | item | ) | [private] |
UPlotCurveThreshold * UPlot::addThreshold | ( | const QString & | name, |
float | value, | ||
Qt::Orientation | orientation = Qt::Horizontal |
||
) |
void UPlot::captureScreen | ( | ) | [private, slot] |
void UPlot::clearData | ( | ) | [slot] |
bool UPlot::contains | ( | const QString & | curveName | ) |
void UPlot::contextMenuEvent | ( | QContextMenuEvent * | event | ) | [protected, virtual] |
void UPlot::createActions | ( | ) | [private] |
void UPlot::createMenus | ( | ) | [private] |
QStringList UPlot::curveNames | ( | ) |
QPen UPlot::getRandomPenColored | ( | ) |
void UPlot::keepAllData | ( | bool | kept | ) |
void UPlot::paintEvent | ( | QPaintEvent * | event | ) | [protected, virtual] |
void UPlot::removeCurve | ( | const UPlotCurve * | curve | ) | [slot] |
void UPlot::removeCurves | ( | ) |
void UPlot::replot | ( | QPainter * | painter | ) | [private] |
void UPlot::resizeEvent | ( | QResizeEvent * | event | ) | [protected, virtual] |
QRectF UPlot::sceneRect | ( | ) | const |
void UPlot::selectScreenCaptureFormat | ( | ) | [private] |
void UPlot::setFixedXAxis | ( | float | x1, |
float | x2 | ||
) |
void UPlot::setFixedYAxis | ( | float | y1, |
float | y2 | ||
) |
void UPlot::setGraphicsView | ( | bool | on | ) |
void UPlot::setMaxVisibleItems | ( | int | maxVisibleItems | ) |
void UPlot::setTitle | ( | const QString & | text | ) |
void UPlot::setupUi | ( | ) | [private] |
void UPlot::setVariableXAxis | ( | ) | [inline] |
void UPlot::setVariableYAxis | ( | ) | [inline] |
void UPlot::setWorkingDirectory | ( | const QString & | workingDirectory | ) |
void UPlot::setXLabel | ( | const QString & | text | ) |
void UPlot::setYLabel | ( | const QString & | text, |
Qt::Orientation | orientation = Qt::Vertical |
||
) |
void UPlot::showCurve | ( | const UPlotCurve * | curve, |
bool | shown | ||
) | [slot] |
void UPlot::showGrid | ( | bool | shown | ) |
void UPlot::showLegend | ( | bool | shown | ) |
void UPlot::showRefreshRate | ( | bool | shown | ) |
void UPlot::showXAxis | ( | bool | shown | ) | [inline] |
void UPlot::showYAxis | ( | bool | shown | ) | [inline] |
QString UPlot::title | ( | ) | const [inline] |
void UPlot::updateAxis | ( | ) | [slot] |
void UPlot::updateAxis | ( | const UPlotCurve * | curve | ) | [private, slot] |
bool UPlot::updateAxis | ( | float | x, |
float | y | ||
) | [private] |
bool UPlot::updateAxis | ( | float | x1, |
float | x2, | ||
float | y1, | ||
float | y2 | ||
) | [private] |
friend class UPlotCurve [friend] |
QAction* UPlot::_aAddHorizontalLine [private] |
QAction* UPlot::_aAddVerticalLine [private] |
QAction* UPlot::_aAutoScreenCapture [private] |
QAction* UPlot::_aChangeTitle [private] |
QAction* UPlot::_aChangeXLabel [private] |
QAction* UPlot::_aChangeYLabel [private] |
QAction* UPlot::_aClearData [private] |
QAction* UPlot::_aGraphicsView [private] |
QAction* UPlot::_aKeepAllData [private] |
QAction* UPlot::_aLimit0 [private] |
QAction* UPlot::_aLimit10 [private] |
QAction* UPlot::_aLimit100 [private] |
QAction* UPlot::_aLimit1000 [private] |
QAction* UPlot::_aLimit50 [private] |
QAction* UPlot::_aLimit500 [private] |
QAction* UPlot::_aLimitCustom [private] |
QAction* UPlot::_aSaveFigure [private] |
QAction* UPlot::_aShowGrid [private] |
QAction* UPlot::_aShowLegend [private] |
QAction* UPlot::_aShowRefreshRate [private] |
QString UPlot::_autoScreenCaptureFormat [private] |
float UPlot::_axisMaximums[4] [private] |
bool UPlot::_axisMaximumsSet[4] [private] |
QAction* UPlot::_aYLabelVertical [private] |
QList<UPlotCurve*> UPlot::_curves [private] |
bool UPlot::_fixedAxis[2] [private] |
QWidget* UPlot::_graphicsViewHolder [private] |
UPlotAxis* UPlot::_horizontalAxis [private] |
UPlotLegend* UPlot::_legend [private] |
int UPlot::_lowestRefreshRate [private] |
int UPlot::_maxVisibleItems [private] |
QMenu* UPlot::_menu [private] |
int UPlot::_penStyleCount [private] |
QTime UPlot::_refreshIntervalTime [private] |
QLabel* UPlot::_refreshRate [private] |
QTime UPlot::_refreshStartTime [private] |
QGraphicsItem* UPlot::_sceneRoot [private] |
QLabel* UPlot::_title [private] |
UPlotAxis* UPlot::_verticalAxis [private] |
QGraphicsView* UPlot::_view [private] |
QString UPlot::_workingDirectory [private] |
QLabel* UPlot::_xLabel [private] |
UOrientableLabel* UPlot::_yLabel [private] |
QList<QGraphicsLineItem *> UPlot::hGridLines [private] |
QList<QGraphicsLineItem *> UPlot::vGridLines [private] |