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 60 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 } |
enum | PaintAttribute { PaintFiltered = 1, ClipPolygons = 2 } |
Public Member Functions | |
QwtPlotCurve () | |
QwtPlotCurve (const QwtText &title) | |
QwtPlotCurve (const QString &title) | |
QwtPlotCurve (const QwtPlotCurve &c) | |
virtual | ~QwtPlotCurve () |
const QwtPlotCurve & | operator= (const QwtPlotCurve &c) |
virtual int | rtti () const |
void | setPaintAttribute (PaintAttribute, bool on=true) |
bool | testPaintAttribute (PaintAttribute) 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) |
void | setTitle (const QwtText &title) |
const QwtText & | 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 QwtText &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 attributes. Definition at line 82 of file qwt_plot_curve.h. |
|
Curve styles.
Definition at line 67 of file qwt_plot_curve.h. |
|
Paint attributes Definition at line 96 of file qwt_plot_curve.h. |
|
Ctor.
Definition at line 154 of file qwt_plot_curve.cpp. References init(). |
|
Ctor.
Definition at line 163 of file qwt_plot_curve.cpp. References init(). |
|
Ctor.
Definition at line 172 of file qwt_plot_curve.cpp. References init(). |
|
Copy Constructor.
Definition at line 180 of file qwt_plot_curve.cpp. |
|
Dtor.
Definition at line 188 of file qwt_plot_curve.cpp. |
|
Return the value of the baseline.
Definition at line 1360 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 518 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 396 of file qwt_plot_curve.cpp. |
|
Copy the contents of a curve into another curve.
Definition at line 213 of file qwt_plot_curve.cpp. References QwtData::copy(), d_data, d_xy, and QwtPlotItem::itemChanged(). Referenced by operator=(), and QwtPlotCurve(). |
|
Definition at line 237 of file qwt_plot_curve.h. |
|
Definition at line 231 of file qwt_plot_curve.h. |
|
Return the size of the data arrays Definition at line 1368 of file qwt_plot_curve.cpp. References QwtData::size(). Referenced by closestPoint(), 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. Setting plot()->canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, true); will result in faster painting, if the paint engine of the canvas widget supports this feature.
Definition at line 571 of file qwt_plot_curve.cpp. References QwtPlot::canvas(), QwtPlot::canvasMap(), draw(), QwtPlotCanvas::paintCache(), QwtPlotItem::plot(), QwtPlotCanvas::testPaintAttribute(), QwtPlotItem::xAxis(), and QwtPlotItem::yAxis(). |
|
Draw an interval of the curve.
Definition at line 664 of file qwt_plot_curve.cpp. References dataSize(), drawCurve(), drawSymbols(), and verifyRange(). |
|
Draw the line part (without symbols) of a curve interval.
Definition at line 709 of file qwt_plot_curve.cpp. References dataSize(), drawDots(), drawLines(), drawSpline(), drawSteps(), and drawSticks(). Referenced by draw(). |
|
Draw dots.
Definition at line 842 of file qwt_plot_curve.cpp. References QwtRect::clip(), QwtPainter::drawPoint(), QwtScaleMap::transform(), x(), and y(). Referenced by drawCurve(). |
|
Draw lines.
Definition at line 749 of file qwt_plot_curve.cpp. References QwtRect::clip(), QwtScaleMap::transform(), x(), and y(). Referenced by drawCurve(), and drawSpline(). |
|
Draw a spline.
Definition at line 980 of file qwt_plot_curve.cpp. References QwtRect::clip(), dataSize(), drawLines(), qwtMax, qwtSqr(), QwtSpline::recalc(), splineSize(), QwtSpline::value(), x(), QwtScaleMap::xTransform(), and y(). Referenced by drawCurve(). |
|
Draw step function.
Definition at line 933 of file qwt_plot_curve.cpp. References QwtRect::clip(), QwtScaleMap::transform(), x(), and y(). Referenced by drawCurve(). |
|
Draw sticks.
Definition at line 812 of file qwt_plot_curve.cpp. References QwtPainter::drawLine(), QwtScaleMap::transform(), x(), and y(). Referenced by drawCurve(). |
|
Draw symbols.
Definition at line 1291 of file qwt_plot_curve.cpp. References QwtSymbol::brush(), QwtSymbol::draw(), QwtPainter::metricsMap(), QwtSymbol::pen(), QwtSymbol::size(), QwtScaleMap::transform(), x(), and y(). Referenced by draw(). |
|
Initialize data members.
Definition at line 197 of file qwt_plot_curve.cpp. References QwtPlotItem::setItemAttribute(), and QwtPlotItem::setZ(). Referenced by QwtPlotCurve(). |
|
boundingRect().right()
Definition at line 136 of file qwt_plot_curve.h. References QwtPlotItem::boundingRect(), and QwtDoubleRect::right(). |
|
boundingRect().bottom()
Definition at line 140 of file qwt_plot_curve.h. References QwtDoubleRect::bottom(), and QwtPlotItem::boundingRect(). |
|
boundingRect().left()
Definition at line 134 of file qwt_plot_curve.h. References QwtPlotItem::boundingRect(), and QwtDoubleRect::left(). |
|
boundingRect().top()
Definition at line 138 of file qwt_plot_curve.h. References QwtPlotItem::boundingRect(), and QwtDoubleRect::top(). |
|
Copy Assignment.
Definition at line 230 of file qwt_plot_curve.cpp. References copy(). |
|
Return the pen used to draw the lines.
Definition at line 365 of file qwt_plot_curve.cpp. Referenced by QwtPlotPrintFilter::apply(), QwtPlotPrintFilter::reset(), and updateLegend(). |
|
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 1347 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 382 of file qwt_plot_curve.cpp. References 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 1166 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Initialize data with a pointer to QwtData.
Definition at line 457 of file qwt_plot_curve.cpp. References QwtData::copy(), and QwtPlotItem::itemChanged(). |
|
Initialize data with an array of points (explicitly shared).
Definition at line 443 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Initialize data with x- and y-arrays (explicitly shared).
Definition at line 428 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 413 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Specify an attribute how to draw the curve. The attributes can be used to modify the drawing algorithm. The following attributes are defined:
The default is, that no paint attributes are enabled.
Definition at line 262 of file qwt_plot_curve.cpp. |
|
Assign a pen.
Definition at line 352 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). Referenced by QwtPlotPrintFilter::apply(), and QwtPlotPrintFilter::reset(). |
|
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 477 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Change the number of interpolated points.
Definition at line 1193 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(), and qwtMax. |
|
Set the curve's drawing style. Valid styles are:
Definition at line 309 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Assign a symbol.
Definition at line 333 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). Referenced by QwtPlotPrintFilter::apply(), and QwtPlotPrintFilter::reset(). |
|
Assign a title to a curve.
Definition at line 497 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Assign a title to a curve.
Definition at line 488 of file qwt_plot_curve.cpp. |
|
Return the spline size.
Definition at line 1205 of file qwt_plot_curve.cpp. Referenced by drawSpline(). |
|
Return the current style.
Definition at line 323 of file qwt_plot_curve.cpp. Referenced by updateLegend(). |
|
Return the current symbol.
Definition at line 343 of file qwt_plot_curve.cpp. Referenced by QwtPlotPrintFilter::apply(), QwtPlotPrintFilter::reset(), and updateLegend(). |
|
Return the current curve attributes.
Definition at line 1183 of file qwt_plot_curve.cpp. |
|
Return the current paint attributes.
Definition at line 274 of file qwt_plot_curve.cpp. |
|
Return the title.
Definition at line 507 of file qwt_plot_curve.cpp. Referenced by updateLegend(). |
|
Checks if a range of indices is valid and corrects it if necessary.
Definition at line 532 of file qwt_plot_curve.cpp. References dataSize(), and qwtLim(). Referenced by draw(). |
|
Definition at line 246 of file qwt_plot_curve.h. References QwtData::x(). Referenced by closestPoint(), drawDots(), drawLines(), drawSpline(), drawSteps(), drawSticks(), and drawSymbols(). |
|
Definition at line 255 of file qwt_plot_curve.h. References QwtData::y(). Referenced by closestPoint(), drawDots(), drawLines(), drawSpline(), drawSteps(), drawSticks(), and drawSymbols(). |