UtiLite
0.3.1
A lite utilities library
|
#include <UPlot.h>
Public Slots | |
void | removeCurve (const UPlotCurve *curve) |
void | clearData () |
Public Member Functions | |
UPlot (QWidget *parent=0) | |
UPlotCurve * | addCurve (const QString &curveName, const QColor &color=QColor()) |
bool | addCurve (UPlotCurve *curve, bool ownershipTransferred=true) |
QStringList | curveNames () |
UPlotCurveThreshold * | addThreshold (const QString &name, float value, Qt::Orientation orientation=Qt::Horizontal) |
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 | ) |
Constructor.
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.