This class can be used to display data as a curve in the x-y plane. It supports different display styles, spline interpolation and symbols.
Definition at line 59 of file qwt_plot_curve.h.
Public Types | |
enum | CurveStyle { NoCurve, Lines, Sticks, Steps, Dots, Spline, UserCurve = 100 } |
enum | CurveAttribute { Auto = 0, Yfx = 1, Xfy = 2, Parametric = 4, Periodic = 8, Inverted = 16 } |
Public Member Functions | |
QwtPlotCurve (const QString &title=QString::null) | |
QwtPlotCurve (const QwtPlotCurve &c) | |
virtual | ~QwtPlotCurve () |
const QwtPlotCurve & | operator= (const QwtPlotCurve &c) |
virtual int | rtti () const |
void | setRawData (const double *x, const double *y, int size) |
void | setData (const double *xData, const double *yData, int size) |
void | setData (const QwtArray< double > &xData, const QwtArray< double > &yData) |
void | setData (const QwtArray< QwtDoublePoint > &data) |
void | setData (const QwtData &data) |
int | closestPoint (const QPoint &pos, double *dist=NULL) const |
QwtData & | data () |
const QwtData & | data () const |
int | dataSize () const |
double | x (int i) const |
double | y (int i) const |
virtual QwtDoubleRect | boundingRect () const |
double | minXValue () const |
double | maxXValue () const |
double | minYValue () const |
double | maxYValue () const |
void | setCurveAttribute (CurveAttribute, bool on=true) |
bool | testCurveAttribute (CurveAttribute) const |
void | setTitle (const QString &title) |
const QString & | title () const |
void | setPen (const QPen &) |
const QPen & | pen () const |
void | setBrush (const QBrush &) |
const QBrush & | brush () const |
void | setBaseline (double ref) |
double | baseline () const |
void | setStyle (CurveStyle style) |
CurveStyle | style () const |
void | setSymbol (const QwtSymbol &s) |
const QwtSymbol & | symbol () const |
void | setSplineSize (int s) |
int | splineSize () const |
virtual void | draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &) const |
virtual void | draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const |
void | draw (int from, int to) const |
virtual void | updateLegend (QwtLegend *) const |
Protected Member Functions | |
void | init (const QString &title) |
void | copy (const QwtPlotCurve &c) |
virtual void | drawCurve (QPainter *p, int style, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const |
virtual void | drawSymbols (QPainter *p, const QwtSymbol &, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const |
void | drawLines (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const |
void | drawSticks (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const |
void | drawDots (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const |
void | drawSteps (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const |
void | drawSpline (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap) const |
void | fillCurve (QPainter *, const QwtScaleMap &, const QwtScaleMap &, QPointArray &) const |
void | closePolyline (const QwtScaleMap &, const QwtScaleMap &, QPointArray &) const |
int | verifyRange (int &i1, int &i2) const |
|
Curve options.
Definition at line 81 of file qwt_plot_curve.h. |
|
Curve styles.
Definition at line 66 of file qwt_plot_curve.h. |
|
Ctor.
Definition at line 126 of file qwt_plot_curve.cpp. |
|
Copy Constructor.
Definition at line 134 of file qwt_plot_curve.cpp. |
|
Dtor.
Definition at line 142 of file qwt_plot_curve.cpp. |
|
Return the value of the baseline.
Definition at line 1142 of file qwt_plot_curve.cpp. |
|
Returns the bounding rectangle of the curve data. If there is no bounding rect, like for empty data the rectangle is invalid: QwtDoubleRect.isValid() == false Reimplemented from QwtPlotItem. Definition at line 425 of file qwt_plot_curve.cpp. References QwtData::boundingRect(). |
|
Return the brush used to fill the area between lines and the baseline.
Definition at line 312 of file qwt_plot_curve.cpp. References QwtSymbol::brush(). Referenced by setBrush(). |
|
Copy the contents of a curve into another curve.
Definition at line 167 of file qwt_plot_curve.cpp. References QwtData::copy(), and QwtPlotItem::itemChanged(). Referenced by operator=(), and QwtPlotCurve(). |
|
the the curve data
Definition at line 219 of file qwt_plot_curve.h. |
|
the the curve data
Definition at line 213 of file qwt_plot_curve.h. Referenced by setData(). |
|
Return the size of the data arrays Definition at line 1150 of file qwt_plot_curve.cpp. References QwtData::size(). Referenced by draw(), drawCurve(), drawSpline(), and verifyRange(). |
|
Draw a set of points of a curve. When observing an measurement while it is running, new points have to be added to an existing curve. drawCurve can be used to display them avoiding a complete redraw of the canvas.
Definition at line 473 of file qwt_plot_curve.cpp. References QwtPlotCanvas::cache(), QwtPlot::canvas(), QwtPlot::canvasMap(), draw(), QwtPlotItem::plot(), QwtPlotCanvas::testPaintAttribute(), QwtPlotItem::xAxis(), and QwtPlotItem::yAxis(). |
|
Draw an interval of the curve.
Definition at line 581 of file qwt_plot_curve.cpp. References dataSize(), drawCurve(), drawSymbols(), and verifyRange(). Referenced by draw(). |
|
Draw the line part (without symbols) of a curve interval.
Definition at line 626 of file qwt_plot_curve.cpp. References dataSize(), drawDots(), drawLines(), drawSpline(), drawSteps(), and drawSticks(). Referenced by draw(). |
|
Draw dots.
Definition at line 725 of file qwt_plot_curve.cpp. References QwtPainter::drawPoint(), x(), and y(). Referenced by drawCurve(). |
|
Draw lines.
Definition at line 666 of file qwt_plot_curve.cpp. Referenced by drawCurve(), and drawSpline(). |
|
Draw a spline.
Definition at line 800 of file qwt_plot_curve.cpp. References dataSize(), drawLines(), qwtSqr(), QwtSpline::recalc(), splineSize(), QwtSpline::value(), x(), and y(). Referenced by drawCurve(). |
|
Draw step function.
Definition at line 759 of file qwt_plot_curve.cpp. Referenced by drawCurve(). |
|
Draw sticks.
Definition at line 695 of file qwt_plot_curve.cpp. References QwtPainter::drawLine(), x(), and y(). Referenced by drawCurve(). |
|
Draw symbols.
Definition at line 1096 of file qwt_plot_curve.cpp. References QwtSymbol::brush(), QwtSymbol::draw(), QwtSymbol::pen(), QwtSymbol::size(), symbol(), x(), and y(). Referenced by draw(). |
|
Initialize data members.
Definition at line 151 of file qwt_plot_curve.cpp. References title(). Referenced by QwtPlotCurve(). |
|
boundingRect().right()
Definition at line 119 of file qwt_plot_curve.h. |
|
boundingRect().bottom()
Definition at line 123 of file qwt_plot_curve.h. |
|
boundingRect().left()
Definition at line 117 of file qwt_plot_curve.h. |
|
boundingRect().top()
Definition at line 121 of file qwt_plot_curve.h. |
|
Copy Assignment.
Definition at line 184 of file qwt_plot_curve.cpp. References copy(). |
|
Return the pen used to draw the lines.
Definition at line 281 of file qwt_plot_curve.cpp. References QwtSymbol::pen(). |
|
Set the value of the baseline. The baseline is needed for filling the curve with a brush or the QwtPlotCurve::Sticks drawing style. The default value is 0.0. The interpretation of the baseline depends on the style options. With QwtPlotCurve::Yfx, the baseline is interpreted as a horizontal line at y = baseline(), with QwtPlotCurve::Yfy, it is interpreted as a vertical line at x = baseline().
Definition at line 1129 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Assign a brush. In case of brush.style() != QBrush::NoBrush and style() != QwtPlotCurve::Sticks the area between the curve and the baseline will be filled. In case !brush.color().isValid() the area will be filled by pen.color(). The fill algorithm simply connects the first and the last curve point to the baseline. So the curve data has to be sorted (ascending or descending).
Definition at line 298 of file qwt_plot_curve.cpp. References QwtSymbol::brush(), brush(), and QwtPlotItem::itemChanged(). |
|
Specify an attribute for the drawing style. The attributes can be used to modify the drawing style. The following attributes are defined:
Definition at line 983 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Initialize data with a pointer to QwtData.
Definition at line 373 of file qwt_plot_curve.cpp. References QwtData::copy(), data(), and QwtPlotItem::itemChanged(). |
|
Initialize data with an array of points (explicitly shared).
Definition at line 359 of file qwt_plot_curve.cpp. References data(), and QwtPlotItem::itemChanged(). |
|
Initialize data with x- and y-arrays (explicitly shared).
Definition at line 344 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Set data by copying x- and y-values from specified memory blocks Contrary to QwtPlot::setCurveRawData, this function makes a 'deep copy' of the data.
Definition at line 329 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Assign a pen.
Definition at line 268 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(), and QwtSymbol::pen(). |
|
Initialize the data by pointing to memory blocks which are not managed by QwtPlotCurve. setRawData is provided for efficiency. It is important to keep the pointers during the lifetime of the underlying QwtCPointerData class.
Definition at line 393 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Change the number of interpolated points.
Definition at line 1010 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Set the curve's drawing style. Valid styles are:
Definition at line 225 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(), and style(). |
|
Assign a symbol.
Definition at line 249 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Assign a title to a curve.
Definition at line 404 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(), and title(). |
|
Return the spline size.
Definition at line 1022 of file qwt_plot_curve.cpp. Referenced by drawSpline(). |
|
Return the current style.
Definition at line 239 of file qwt_plot_curve.cpp. Referenced by setStyle(). |
|
Return the current symbol.
Definition at line 259 of file qwt_plot_curve.cpp. Referenced by drawSymbols(). |
|
Return the current style options.
Definition at line 1000 of file qwt_plot_curve.cpp. |
|
Return the title.
Definition at line 414 of file qwt_plot_curve.cpp. Referenced by init(), QwtPlotCurve(), and setTitle(). |
|
Checks if a range of indices is valid and corrects it if necessary.
Definition at line 439 of file qwt_plot_curve.cpp. References dataSize(), and qwtLim(). Referenced by draw(). |
|
Definition at line 228 of file qwt_plot_curve.h. References QwtData::x(). Referenced by drawDots(), drawLines(), drawSpline(), drawSteps(), drawSticks(), and drawSymbols(). |
|
Definition at line 237 of file qwt_plot_curve.h. References QwtData::y(). Referenced by drawDots(), drawLines(), drawSpline(), drawSteps(), drawSticks(), and drawSymbols(). |