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 56 of file qwt_plot_curve.h.
Public Types | |
enum | CurveType { Yfx, Xfy } |
enum | CurveStyle { NoCurve, Lines, Sticks, Steps, Dots, UserCurve = 100 } |
enum | CurveAttribute { Inverted = 1, Fitted = 2 } |
enum | PaintAttribute { PaintFiltered = 1, ClipPolygons = 2 } |
Public Member Functions | |
QwtPlotCurve () | |
QwtPlotCurve (const QwtText &title) | |
QwtPlotCurve (const QString &title) | |
virtual | ~QwtPlotCurve () |
virtual int | rtti () const |
void | setCurveType (CurveType) |
CurveType | curveType () 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 QPolygonF &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 | 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 | setCurveFitter (QwtCurveFitter *) |
QwtCurveFitter * | curveFitter () 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 () |
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 | fillCurve (QPainter *, const QwtScaleMap &, const QwtScaleMap &, QwtPolygon &) const |
void | closePolyline (const QwtScaleMap &, const QwtScaleMap &, QwtPolygon &) const |
|
Curve attributes.
Definition at line 85 of file qwt_plot_curve.h. |
|
Curve styles.
Definition at line 69 of file qwt_plot_curve.h. |
|
Paint attributes
Definition at line 95 of file qwt_plot_curve.h. |
|
Ctor.
Definition at line 138 of file qwt_plot_curve.cpp. References init(). |
|
Ctor.
Definition at line 148 of file qwt_plot_curve.cpp. References init(). |
|
Ctor.
Definition at line 158 of file qwt_plot_curve.cpp. References init(). |
|
Dtor.
Definition at line 165 of file qwt_plot_curve.cpp. |
|
Return the value of the baseline
Definition at line 1197 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.
Reimplemented from QwtPlotItem. Definition at line 437 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 341 of file qwt_plot_curve.cpp. |
|
Complete a polygon to be a closed polygon including the area between the original polygon and the baseline.
Definition at line 1091 of file qwt_plot_curve.cpp. References QwtScaleMap::transform(). Referenced by fillCurve(). |
|
Return the curve type
Definition at line 1027 of file qwt_plot_curve.cpp. |
|
Definition at line 223 of file qwt_plot_curve.h. |
|
Definition at line 217 of file qwt_plot_curve.h. Referenced by setData(). |
|
Return the size of the data arrays
Definition at line 1206 of file qwt_plot_curve.cpp. References QwtData::size(). Referenced by closestPoint(), draw(), and drawCurve(). |
|
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 478 of file qwt_plot_curve.cpp. References QwtPlot::canvas(), and QwtPlotItem::plot(). |
|
Draw an interval of the curve.
Definition at line 569 of file qwt_plot_curve.cpp. References dataSize(), drawCurve(), and drawSymbols(). |
|
Draw the complete curve.
Implements QwtPlotItem. Definition at line 454 of file qwt_plot_curve.cpp. |
|
Draw the line part (without symbols) of a curve interval.
Definition at line 613 of file qwt_plot_curve.cpp. References dataSize(), drawDots(), drawLines(), drawSteps(), drawSticks(), and testCurveAttribute(). Referenced by draw(). |
|
Draw dots
Definition at line 818 of file qwt_plot_curve.cpp. References QwtPainter::drawPoint(), QwtScaleMap::transform(), x(), and y(). Referenced by drawCurve(). |
|
Draw lines. If the CurveAttribute Fitted is enabled a QwtCurveFitter tries to interpolate/smooth the curve, before it is painted.
Definition at line 659 of file qwt_plot_curve.cpp. References x(), QwtScaleMap::xTransform(), and y(). Referenced by drawCurve(). |
|
Draw step function The direction of the steps depends on Inverted attribute.
Definition at line 914 of file qwt_plot_curve.cpp. References QwtScaleMap::transform(), x(), and y(). Referenced by drawCurve(). |
|
Draw sticks
Definition at line 788 of file qwt_plot_curve.cpp. References QwtPainter::drawLine(), QwtScaleMap::transform(), x(), and y(). Referenced by drawCurve(). |
|
Draw symbols.
Definition at line 1128 of file qwt_plot_curve.cpp. References QwtSymbol::brush(), QwtSymbol::draw(), QwtPainter::metricsMap(), QwtSymbol::pen(), QwtSymbol::size(), symbol(), QwtScaleMap::transform(), x(), and y(). Referenced by draw(). |
|
Fill the area between the curve and the baseline with the curve brush
Definition at line 1057 of file qwt_plot_curve.cpp. References closePolyline(), and QwtPainter::drawPolygon(). |
|
Initialize data members.
Definition at line 174 of file qwt_plot_curve.cpp. References QwtPlotItem::setItemAttribute(), and QwtPlotItem::setZ(). Referenced by QwtPlotCurve(). |
|
boundingRect().right()
Definition at line 139 of file qwt_plot_curve.h. References QwtPlotItem::boundingRect(). |
|
boundingRect().bottom()
Definition at line 143 of file qwt_plot_curve.h. References QwtPlotItem::boundingRect(). |
|
boundingRect().left()
Definition at line 137 of file qwt_plot_curve.h. References QwtPlotItem::boundingRect(). |
|
boundingRect().top()
Definition at line 141 of file qwt_plot_curve.h. References QwtPlotItem::boundingRect(). |
|
Return the pen used to draw the lines.
Definition at line 311 of file qwt_plot_curve.cpp. Referenced by updateLegend(). |
|
Set the value of the baseline. The baseline is needed for filling the curve with a brush or the Sticks drawing style. The default value is 0.0. The interpretation of the baseline depends on the CurveType. 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 1184 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 328 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Specify an attribute for drawing the curve. The attributes can be used to modify the drawing style. The following attributes are defined:
Definition at line 976 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Assign the curve type QwtPlotCurve::Yfx Draws y as a function of x (the default). The baseline is interpreted as a horizontal line with y = baseline(). QwtPlotCurve::Xfy Draws x as a function of y. The baseline is interpreted as a vertical line with x = baseline(). The baseline is used for aligning the sticks, or filling the curve with a brush.
Definition at line 1014 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Initialize data with a pointer to QwtData.
Definition at line 404 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 390 of file qwt_plot_curve.cpp. |
|
Initialize data with x- and y-arrays (explicitly shared).
Definition at line 373 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Set data by copying x- and y-values from specified memory blocks. Contrary to setCurveRawData(), this function makes a 'deep copy' of the data.
Definition at line 358 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 211 of file qwt_plot_curve.cpp. |
|
Assign a pen.
Definition at line 298 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
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 424 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Set the curve's drawing style. Valid styles are:
Definition at line 255 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Assign a symbol.
Definition at line 278 of file qwt_plot_curve.cpp. References QwtPlotItem::itemChanged(). |
|
Return the current style.
Definition at line 268 of file qwt_plot_curve.cpp. Referenced by updateLegend(). |
|
Return the current symbol.
Definition at line 288 of file qwt_plot_curve.cpp. Referenced by drawSymbols(), and updateLegend(). |
|
Return the current curve attributes
Definition at line 993 of file qwt_plot_curve.cpp. Referenced by drawCurve(). |
|
Return the current paint attributes.
Definition at line 223 of file qwt_plot_curve.cpp. |
|
Update the widget that represents the item on the legend. updateLegend() is called from itemChanged() to adopt the widget representing the item on the legend to its new configuration. The default implementation is made for QwtPlotCurve and updates a QwtLegendItem(), but an item could be represented by any type of widget, by overloading legendItem() and updateLegend().
Reimplemented from QwtPlotItem. Definition at line 1240 of file qwt_plot_curve.cpp. References QwtLegend::displayPolicy(), QwtLegend::find(), QwtLegend::identifierMode(), QwtPlotItem::legendItem(), pen(), style(), symbol(), QwtPlotItem::title(), and QwtPlotItem::updateLegend(). |
|
Definition at line 232 of file qwt_plot_curve.h. References QwtData::x(). Referenced by closestPoint(), drawDots(), drawLines(), drawSteps(), drawSticks(), and drawSymbols(). |
|
Definition at line 241 of file qwt_plot_curve.h. References QwtData::y(). Referenced by closestPoint(), drawDots(), drawLines(), drawSteps(), drawSticks(), and drawSymbols(). |