UtiLite  0.3.1
A lite utilities library
Public Slots | Public Member Functions | Friends
UPlot Class Reference

#include <UPlot.h>

List of all members.

Public Slots

void removeCurve (const UPlotCurve *curve)
void clearData ()

Public Member Functions

 UPlot (QWidget *parent=0)
UPlotCurveaddCurve (const QString &curveName, const QColor &color=QColor())
bool addCurve (UPlotCurve *curve, bool ownershipTransferred=true)
QStringList curveNames ()
UPlotCurveThresholdaddThreshold (const QString &name, float value, Qt::Orientation orientation=Qt::Horizontal)

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

Constructor & Destructor Documentation

UPlot::UPlot ( QWidget *  parent = 0)

Constructor.


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).

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

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

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

Add a threshold to the plot.

void UPlot::clearData ( ) [slot]

Clear all curves' data.

QStringList UPlot::curveNames ( )

Get all curve names.

void UPlot::removeCurve ( const UPlotCurve curve) [slot]

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


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Enumerations Friends Defines