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_curve.h.
Public Types | |
enum | CurveStyle { NoCurve, Lines, Sticks, Steps, Dots, Spline, UserCurve = 100 } |
enum | CurveOption { Auto = 0, Yfx = 1, Xfy = 2, Parametric = 4, Periodic = 8, Inverted = 16 } |
Public Member Functions | |
QwtCurve (const QString &title=QString::null) | |
QwtCurve (const QwtCurve &c) | |
virtual | ~QwtCurve () |
const QwtCurve & | operator= (const QwtCurve &c) |
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 | 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 | setOptions (int t) |
int | options () 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 (int style, int options=0) |
int | style () const |
void | setSymbol (const QwtSymbol &s) |
const QwtSymbol & | symbol () const |
void | setSplineSize (int s) |
int | splineSize () const |
virtual void | draw (QPainter *p, const QwtDiMap &xMap, const QwtDiMap &yMap, int from=0, int to=-1) |
Protected Member Functions | |
void | init (const QString &title) |
void | copy (const QwtCurve &c) |
virtual void | drawCurve (QPainter *p, int style, const QwtDiMap &xMap, const QwtDiMap &yMap, int from, int to) |
virtual void | drawSymbols (QPainter *p, QwtSymbol &, const QwtDiMap &xMap, const QwtDiMap &yMap, int from, int to) |
void | drawLines (QPainter *p, const QwtDiMap &xMap, const QwtDiMap &yMap, int from, int to) |
void | drawSticks (QPainter *p, const QwtDiMap &xMap, const QwtDiMap &yMap, int from, int to) |
void | drawDots (QPainter *p, const QwtDiMap &xMap, const QwtDiMap &yMap, int from, int to) |
void | drawSteps (QPainter *p, const QwtDiMap &xMap, const QwtDiMap &yMap, int from, int to) |
void | drawSpline (QPainter *p, const QwtDiMap &xMap, const QwtDiMap &yMap) |
void | closePolyline (const QwtDiMap &, const QwtDiMap &, QPointArray &) const |
virtual void | curveChanged () |
int | verifyRange (int &i1, int &i2) |
Protected Attributes | |
QwtSpline | d_spx |
QwtSpline | d_spy |
|
Curve options.
|
|
Curve styles.
|
|
Ctor.
References init(). |
|
Copy Constructor. Definition at line 60 of file qwt_curve.cpp. |
|
Dtor. Definition at line 52 of file qwt_curve.cpp. |
|
Return the value of the baseline.
Referenced by QwtPlot::curveBaseline(). |
|
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 Definition at line 309 of file qwt_curve.cpp. References QwtData::boundingRect(). Referenced by QwtPlot::updateAxes(). |
|
Return the brush used to fill the area between lines and the baseline. Definition at line 196 of file qwt_curve.cpp. Referenced by QwtPlot::curveBrush(). |
|
Complete a polygon to be a closed polygon including the area between the original polygon and the baseline.
References QwtDiMap::transform(). Referenced by drawDots(), drawLines(), drawSpline(), and drawSteps(). |
|
Copy the contents of a curve into another curve. Definition at line 36 of file qwt_curve.cpp. References QwtData::copy(), d_data, d_options, d_pen, d_ref, d_splineSize, d_style, d_sym, and d_title. Referenced by operator=(), and QwtCurve(). |
|
Notify a change of attributes. This virtual function is called when an attribute of the curve has changed. It can be redefined by derived classes. The default implementation does nothing.
Reimplemented in QwtPlotCurve. Definition at line 927 of file qwt_curve.cpp. Referenced by operator=(), setBaseline(), setBrush(), setData(), setOptions(), setPen(), setRawData(), setSplineSize(), setStyle(), setSymbol(), and setTitle(). |
|
Return the size of the data arrays Definition at line 915 of file qwt_curve.cpp. References QwtData::size(). Referenced by QwtPlot::closestCurve(), draw(), drawCurve(), drawSpline(), and verifyRange(). |
|
Draw an intervall of the curve.
References dataSize(), drawCurve(), drawSymbols(), QwtSymbol::style(), and verifyRange(). Referenced by QwtPlot::drawCanvasItems(), and QwtPlot::drawCurve(). |
|
Draw the line part (without symbols) of a curve interval.
References dataSize(), drawDots(), drawLines(), drawSpline(), drawSteps(), and drawSticks(). Referenced by draw(). |
|
Draw dots.
References closePolyline(), QwtPainter::drawPoint(), QwtPainter::drawPolygon(), QwtDiMap::transform(), x(), and y(). Referenced by drawCurve(). |
|
Draw lines.
References closePolyline(), QwtPainter::drawPolygon(), QwtPainter::drawPolyline(), QwtDiMap::transform(), x(), and y(). Referenced by drawCurve(), and drawSpline(). |
|
Draw a spline.
References closePolyline(), dataSize(), drawLines(), QwtPainter::drawPolygon(), QwtPainter::drawPolyline(), qwtSqr(), QwtSpline::recalc(), QwtSpline::value(), x(), QwtDiMap::xTransform(), and y(). Referenced by drawCurve(). |
|
Draw step function.
References closePolyline(), QwtPainter::drawPolygon(), QwtPainter::drawPolyline(), QwtDiMap::transform(), x(), and y(). Referenced by drawCurve(). |
|
Draw sticks.
References QwtPainter::drawLine(), QwtDiMap::transform(), x(), and y(). Referenced by drawCurve(). |
|
Draw symbols.
References QwtSymbol::brush(), QwtSymbol::draw(), QwtSymbol::pen(), QwtSymbol::size(), QwtDiMap::transform(), x(), and y(). Referenced by draw(). |
|
Initialize data members. Definition at line 22 of file qwt_curve.cpp. Referenced by QwtCurve(). |
|
boundingRect().x2() Definition at line 113 of file qwt_curve.h. |
|
boundingRect().y2() Definition at line 117 of file qwt_curve.h. |
|
boundingRect().x1() Definition at line 111 of file qwt_curve.h. |
|
boundingRect().y1() Definition at line 115 of file qwt_curve.h. |
|
Copy Assignment. Definition at line 69 of file qwt_curve.cpp. References copy(), and curveChanged(). Referenced by QwtPlotCurve::operator=(). |
|
Return the current style options.
Referenced by QwtPlot::curveOptions(). |
|
Return the pen used to draw the lines.
Referenced by QwtPlotPrintFilter::apply(), QwtPlot::curvePen(), QwtPlotPrintFilter::reset(), and QwtPlot::updateLegendItem(). |
|
Set the value of the baseline. The baseline is needed for filling the curve with a brush or the QwtCurve::Sticks drawing style. The default value is 0.0. The interpretation of the baseline depends on the style options. With QwtCurve::Yfx, the baseline is interpreted as a horizontal line at y = baseline(), with QwtCurve::Yfy, it is interpreted as a vertical line at x = baseline().
References curveChanged(). Referenced by QwtPlot::setCurveBaseline(). |
|
Assign a brush. In case of brush.style() != QBrush::NoBrush and style() != QwtCurve::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).
References curveChanged(). Referenced by QwtPlot::setCurveBrush(). |
|
Initialize data with a pointer to QwtData.
References QwtData::copy(), and curveChanged(). |
|
Initialize data with an array of points (explicitly shared).
References curveChanged(). |
|
Initialize data with x- and y-arrays (explicitly shared).
References curveChanged(). |
|
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.
References curveChanged(). Referenced by QwtPlot::setCurveData(). |
|
Specify options for the drawing style. The options can be used to modify the drawing style. Options can be or-combined. The following options are defined:
References curveChanged(). Referenced by QwtPlot::setCurveOptions(). |
|
Assign a pen.
References curveChanged(). Referenced by QwtPlotPrintFilter::apply(), QwtPlotPrintFilter::reset(), and QwtPlot::setCurvePen(). |
|
Initialize the data by pointing to memory blocks which are not managed by QwtCurve. setRawData is provided for efficiency. It is important to keep the pointers during the lifetime of the underlying QwtCPointerData class.
References curveChanged(). Referenced by QwtPlot::setCurveRawData(). |
|
Change the number of interpolated points.
References curveChanged(). Referenced by QwtPlot::setCurveSplineSize(). |
|
Set the curve's drawing style. Valid styles are:
References curveChanged(). Referenced by QwtPlot::setCurveStyle(). |
|
Assign a symbol.
References curveChanged(). Referenced by QwtPlotPrintFilter::apply(), QwtPlotPrintFilter::reset(), and QwtPlot::setCurveSymbol(). |
|
Assign a title to a curve.
References curveChanged(). Referenced by QwtPlot::insertCurve(), and QwtPlot::setCurveTitle(). |
|
Return the spline size.
Referenced by QwtPlot::curveSplineSize(). |
|
Return the current style.
Referenced by QwtPlot::curveStyle(), and QwtPlot::updateLegendItem(). |
|
Return the current symbol.
Referenced by QwtPlotPrintFilter::apply(), QwtPlot::curveSymbol(), QwtPlotPrintFilter::reset(), and QwtPlot::updateLegendItem(). |
|
Return the title.
Referenced by QwtPlot::curveTitle(), and QwtPlot::updateLegendItem(). |
|
Checks if a range of indices is valid and corrects it if necessary.
References dataSize(), qwtLim(), and qwtSort(). Referenced by draw(). |
|
Referenced by QwtPlot::closestCurve(), drawDots(), drawLines(), drawSpline(), drawSteps(), drawSticks(), and drawSymbols(). |
|
References QwtData::y(). Referenced by QwtPlot::closestCurve(), drawDots(), drawLines(), drawSpline(), drawSteps(), drawSticks(), and drawSymbols(). |