QwtPlotCurve(3)
π¦ QwtPlotCurve β Qwt User's Guide π¦
πΈ NAME πΈ
QwtPlotCurve β and honestly? that's the whole name entry. No cute little dash-description after it, bestie, it's justβ¦ the class. Iconic minimalism. π
β¨ SYNOPSIS β¨
#include <qwt_plot_curve.h>
Inherits QwtPlotItem. Yeah she's got a whole family tree. π³
π Public Types
enum CurveAttribute { Inverted = 1, Fitted = 2 }
enum CurveStyle { NoCurve, Lines, Sticks, Steps, Dots, UserCurve = 100 }
enum CurveType { Yfx, Xfy }
enum PaintAttribute { PaintFiltered = 1, ClipPolygons = 2 }
π Public Member Functions
QwtPlotCurve ()QwtPlotCurve (const QwtText &title)QwtPlotCurve (const QString &title)virtual ~QwtPlotCurve ()double baseline () constvirtual QwtDoubleRect boundingRect () constconst QBrush & brush () constint closestPoint (const QPoint &pos, double *dist=NULL) constQwtCurveFitter * curveFitter () constCurveType curveType () constQwtData & data ()const QwtData & data () constint dataSize () constvirtual void draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &) constvirtual void draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) constvoid draw (int from, int to) constdouble maxXValue () constdouble maxYValue () constdouble minXValue () constdouble minYValue () constconst QPen & pen () constvirtual int rtti () constvoid setBaseline (double ref)void setBrush (const QBrush &)void setCurveAttribute (CurveAttribute, bool on=true)void setCurveFitter (QwtCurveFitter *)void setCurveType (CurveType)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)void setPaintAttribute (PaintAttribute, bool on=true)void setPen (const QPen &)void setRawData (const double *x, const double *y, int size)void setStyle (CurveStyle style)void setSymbol (const QwtSymbol &s)CurveStyle style () constconst QwtSymbol & symbol () constbool testCurveAttribute (CurveAttribute) constbool testPaintAttribute (PaintAttribute) constvirtual void updateLegend (QwtLegend *) constdouble x (int i) constdouble y (int i) const
π§ Protected Member Functions
void closePolyline (const QwtScaleMap &, const QwtScaleMap &, QwtPolygon &) constvirtual void drawCurve (QPainter *p, int style, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) constvoid drawDots (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) constvoid drawLines (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) constvoid drawSteps (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) constvoid drawSticks (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) constvirtual void drawSymbols (QPainter *p, const QwtSymbol &, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) constvoid fillCurve (QPainter *, const QwtScaleMap &, const QwtScaleMap &, QwtPolygon &) constvoid init ()
π Detailed Description π
A plot item, that represents a series of points. β¨
A curve is the representation of a series of points in the x-y plane. It supports different display styles, interpolation (spline, f.e.) and symbols. Obsessed. π₯
π Usage
- a) Assign curve properties When a curve is created, it is configured to draw black solid lines in
Linesstyle and no symbols. You can change this by callingsetPen(),setStyle()andsetSymbol(). - b) Connect/Assign data.
QwtPlotCurvegets its points using aQwtDataobject offering a bridge to the real storage of the points (likeQAbstractItemModel). There are several convenience classes derived fromQwtData, that also store the points inside (likeQStandardItemModel).QwtPlotCurvealso offers a couple of variations ofsetData(), that buildQwtDataobjects from arrays internally. - c) Attach the curve to a plot See
QwtPlotItem::attach()
Example: see examples/bode
See also: QwtPlot, QwtData, QwtSymbol, QwtScaleMap
π Member Enumeration Documentation π
π¦ enum QwtPlotCurve::CurveAttribute
Attribute for drawing the curve. ποΈ
Fitted(in combination with theLinesQwtPlotCurve::CurveStyleonly) AQwtCurveFittertries to interpolate/smooth the curve, before it is painted. Note that curve fitting requires temporary memory for calculating coefficients and additional points. If painting inFittedmode is slow it might be better to fit the points, before they are passed toQwtPlotCurve.InvertedForStepsonly. Draws a step function from the right to the left.
See also: setCurveAttribute(), testCurveAttribute(), curveFitter()
π
enum QwtPlotCurve::CurveStyle
Curve styles. β¨
NoCurveDon't draw a curve. Note: This doesn't affect the symbols.LinesConnect the points with straight lines. The lines might be interpolated depending on the'Fitted'attribute. Curve fitting can be configured usingsetCurveFitter().SticksDraw vertical (Yfx) or horizontal (Xfy) sticks from a baseline which is defined bysetBaseline().StepsConnect the points with a step function. The step function is drawn from the left to the right or vice versa, depending on the'Inverted'attribute.DotsDraw dots at the locations of the data points. Note: This is different from a dotted line (seesetPen()), and faster than a curve inNoStylestyle with a symbol painting a point.UserCurveStyles >=UserCurveare reserved for derived classes ofQwtPlotCurvethat overloaddrawCurve()with additional application specific curve types.
See also: setStyle(), style()
π enum QwtPlotCurve::CurveType
Curve type. π«
YfxDraws y as a function of x (the default). The baseline is interpreted as a horizontal line withy = baseline().XfyDraws x as a function of y. The baseline is interpreted as a vertical line withx = baseline().
The baseline is used for aligning the sticks, or filling the curve with a brush.
See also: setCurveType(), curveType(), baseline() brush()
β enum QwtPlotCurve::PaintAttribute
Attributes to modify the drawing algorithm. π¨
PaintFilteredTries to reduce the data that has to be painted, by sorting out duplicates, or paintings outside the visible area. Might have a notable impact on curves with many close points. Only a couple of very basic filtering algos are implemented.ClipPolygonsClip polygons before painting them. In situations, where points are far outside the visible area (f.e when zooming deep) this might be a substantial improvement for the painting performance (especially on Windows).
The default is, that no paint attributes are enabled. π«Ά
See also: setPaintAttribute(), testPaintAttribute()
π Constructor & Destructor Documentation π
QwtPlotCurve::QwtPlotCurve (const QwtText &title) [explicit]
Constructor πΈ
Parameters:
titleβ Title of the curve
QwtPlotCurve::QwtPlotCurve (const QString &title) [explicit]
Constructor πΈ
Parameters:
titleβ Title of the curve
π Member Function Documentation π
double QwtPlotCurve::baseline () const
Return the value of the baseline. π
See also: setBaseline()
QwtDoubleRect QwtPlotCurve::boundingRect () const [virtual]
Returns the bounding rectangle of the curve data. If there is no bounding rect, like for empty data the rectangle is invalid. π
See also: QwtData::boundingRect(), QwtDoubleRect::isValid()
Reimplemented from QwtPlotItem.
const QBrush & QwtPlotCurve::brush () const
Return the brush used to fill the area between lines and the baseline. ποΈ
See also: setBrush(), setBaseline(), baseline()
void QwtPlotCurve::closePolyline (const QwtScaleMap &xMap, const QwtScaleMap &yMap, QwtPolygon &pa) const [protected]
Complete a polygon to be a closed polygon including the area between the original polygon and the baseline. π
Parameters:
xMapβ X mapyMapβ Y mappaβ Polygon to be completed
int QwtPlotCurve::closestPoint (const QPoint &pos, double *dist = NULL) const
Find the closest curve point for a specific position. π
Parameters:
posβ Position, where to look for the closest curve pointdistβ Ifdist != NULL,closestPoint()returns the distance between the position and the closest curve point
Returns: Index of the closest curve point, or -1 if none can be found (f.e when the curve has no points)
Note: closestPoint() implements a dumb algorithm, that iterates over all points. π she's not smart, she's just thorough.
QwtCurveFitter * QwtPlotCurve::curveFitter () const
Get the curve fitter. If curve fitting is disabled NULL is returned.
Returns: Curve fitter
QwtPlotCurve::CurveType QwtPlotCurve::curveType () const
Return the curve type. π
See also: CurveType, setCurveType()
QwtData & QwtPlotCurve::data () [inline]
Returns: the curve data
const QwtData & QwtPlotCurve::data () const [inline]
Returns: the curve data
int QwtPlotCurve::dataSize () const
Return the size of the data arrays. π’
See also: setData()
void QwtPlotCurve::draw (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &canvasRect) const [virtual]
Draw the complete curve. π¨
Parameters:
painterβ PainterxMapβ Maps x-values into pixel coordinates.yMapβ Maps y-values into pixel coordinates.
See also: drawCurve(), drawSymbols()
Implements QwtPlotItem.
void QwtPlotCurve::draw (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const [virtual]
Draw an interval of the curve. βοΈ
Parameters:
painterβ PainterxMapβ maps x-values into pixel coordinates.yMapβ maps y-values into pixel coordinates.fromβ index of the first point to be paintedtoβ index of the last point to be painted. Ifto < 0the curve will be painted to its last point.
See also: drawCurve(), drawSymbols(),
void QwtPlotCurve::draw (int from, int to) const
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. π₯
Okay bestie, we're back in the draw() function β here's the rest of its deets:
Parameters:
fromβ Index of the first point to be paintedtoβ Index of the last point to be painted. Ifto < 0the curve will be painted to its last point.
See also: drawCurve(), drawSymbols()
drawCurve() β the line-drawing queen π
void QwtPlotCurve::drawCurve (QPainter *painter, intstyle, const QwtScaleMap &xMap, const QwtScaleMap &yMap, intfrom, intto) const [protected], [virtual]
Draw the line part (without symbols) of a curve interval. No cap, this is the one that actually puts the lines on the screen, bestie. π
Parameters:
painterβ Painterstyleβ curve style, seeQwtPlotCurve::CurveStylexMapβ x mapyMapβ y mapfromβ index of the first point to be paintedtoβ index of the last point to be painted
See also: draw(), drawDots(), drawLines(), drawSteps(), drawSticks()
drawDots() β dot dot dot π
void QwtPlotCurve::drawDots (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, intfrom, intto) const [protected]
Draw dots. Literally just dots. It's giving minimalist chic. β¨
Parameters:
painterβ PainterxMapβ x mapyMapβ y mapfromβ index of the first point to be paintedtoβ index of the last point to be painted
See also: draw(), drawCurve(), drawSticks(), drawLines(), drawSteps()
drawLines() β lines that slay π
void QwtPlotCurve::drawLines (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, intfrom, intto) const [protected]
Draw lines. If the CurveAttribute Fitted is enabled a QwtCurveFitter tries to interpolate/smooth the curve, before it is painted. So it's extra fancy. π
Parameters:
painterβ PainterxMapβ x mapyMapβ y mapfromβ index of the first point to be paintedtoβ index of the last point to be painted
See also: setCurveAttribute(), setCurveFitter(), draw(), drawLines(), drawDots(), drawSteps(), drawSticks()
Not me noticing drawLines() is in its own See also β iconic self-love, periodt. π
drawSteps() β step function, periodt πͺ
void QwtPlotCurve::drawSteps (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, intfrom, intto) const [protected]
Draw step function. The direction of the steps depends on Inverted attribute. So it's like stairs, but make it fashion. π
Parameters:
painterβ PainterxMapβ x mapyMapβ y mapfromβ index of the first point to be paintedtoβ index of the last point to be painted
See also: CurveAttribute, setCurveAttribute(), draw(), drawCurve(), drawDots(), drawLines(), drawSticks()
drawSticks() β sticks and stones πͺ΅
void QwtPlotCurve::drawSticks (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, intfrom, intto) const [protected]
Draw sticks. It's giving rustic vibes. πΏ
Parameters:
painterβ PainterxMapβ x mapyMapβ y mapfromβ index of the first point to be paintedtoβ index of the last point to be painted
See also: draw(), drawCurve(), drawDots(), drawLines(), drawSteps()
drawSymbols() β symbols, but make it cute π¦
void QwtPlotCurve::drawSymbols (QPainter *painter, const QwtSymbol &symbol, const QwtScaleMap &xMap, const QwtScaleMap &yMap, intfrom, intto) const [protected], [virtual]
Draw symbols. All the little icons that make your plot pop. β¨
Parameters:
painterβ Paintersymbolβ Curve symbolxMapβ x mapyMapβ y mapfromβ index of the first point to be paintedtoβ index of the last point to be painted
See also: setSymbol(), draw(), drawCurve()
fillCurve() β fill it up, bestie π¨
void QwtPlotCurve::fillCurve (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, QwtPolygon &pa) const [protected]
Fill the area between the curve and the baseline with the curve brush. It's like coloring inside the lines, but make it data viz. π
Parameters:
painterβ PainterxMapβ x mapyMapβ y mappaβ Polygon
See also: setBrush(), setBaseline(), setCurveType()
pen() β return the pen ποΈ
const QPen & QwtPlotCurve::pen () const
Return the pen used to draw the lines. The pen is mightier than the sword, no cap. π
See also: setPen(), brush()
rtti() β runtime type info, iykyk π
int QwtPlotCurve::rtti () const [virtual]
Returns: QwtPlotItem::Rtti_PlotCurve
Reimplemented from QwtPlotItem.
setBaseline() β set the baseline, lowkey important π
void QwtPlotCurve::setBaseline (doublereference)
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(). So it's flexible, fr fr. π
Parameters:
referenceβ baseline
See also: baseline(), setBrush(), setStyle(), setCurveType()
setBrush() β assign a brush ποΈ
void QwtPlotCurve::setBrush (const QBrush &brush)
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). No cap, sort your data. π€
Parameters:
brushβ New brush
See also: brush(), setBaseline(), baseline()
setCurveAttribute() β set an attribute β¨
void QwtPlotCurve::setCurveAttribute (CurveAttributeattribute, boolon = true)
Specify an attribute for drawing the curve. It's giving customization. π
Parameters:
attributeβ Curve attributeonβ On/Off
/sa CurveAttribute, testCurveAttribute(), setCurveFitter()
setCurveFitter() β set a curve fitter π§΅
void QwtPlotCurve::setCurveFitter (QwtCurveFitter *curveFitter)
Assign a curve fitter setCurveFitter(NULL) disables curve fitting. So if you want smooth, you know what to do. β¨
Parameters:
curveFitterβ Curve fitter
setCurveType() β set the curve type π’
void QwtPlotCurve::setCurveType (CurveTypecurveType)
Assign the curve type. It's giving direction. π§
Parameters:
curveTypeβYfxorXfy
See also: CurveType, curveType()
setData() β set data (deep copy) π
void QwtPlotCurve::setData (const double *xData, const double *yData, intsize)
Set data by copying x- and y-values from specified memory blocks. Contrary to setCurveRawData(), this function makes a 'deep copy' of the data. So you can yeet the original arrays after, no cap. π
Parameters:
xDataβ Pointer to x valuesyDataβ Pointer to y valuessizeβ Size ofxDataandyData
Note: Internally the data is stored in a QwtArrayData object
setData() β set data (QwtArray) π
void QwtPlotCurve::setData (const QwtArray< double > &xData, const QwtArray< double > &yData)
Initialize data with x- and y-arrays (explicitly shared) ( Builds an QwtArrayData object internally ). Sharing is caring, bestie. π«Ά
Parameters:
xDataβ x datayDataβ y data
Note: Internally the data is stored in a QwtArrayData object
setData() β set data (QPolygonF) π§©
void QwtPlotCurve::setData (const QPolygonF &data)
Initialize data with an array of points (explicitly shared). Points are literally the vibe. β¨
Parameters:
dataβ Data
Note: Internally the data is stored in a QwtPolygonFData object
setData() β set data (QwtData) ποΈ
void QwtPlotCurve::setData (const QwtData &data)
Initialize data with a pointer to QwtData. It's giving abstraction. π
Parameters:
dataβ Data
See also: QwtData::copy()
setPaintAttribute() β set paint attribute π¨
void QwtPlotCurve::setPaintAttribute (PaintAttributeattribute, boolon = true)
Specify an attribute how to draw the curve. Customization is key. π
Parameters:
attributeβ Paint attributeonβ On/Off
/sa PaintAttribute, testPaintAttribute()
setPen() β set the pen ποΈ
void QwtPlotCurve::setPen (const QPen &pen)
Assign a pen. The width of non cosmetic pens is scaled according to the resolution of the paint device. So it stays sharp, no cap. π
Parameters:
penβ New pen
See also: pen(), brush(), QwtPainter::scaledPen()
setRawData() β set raw data β‘
void QwtPlotCurve::setRawData (const double *xData, const double *yData, intsize)
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. So don't let them dangle, bestie. π«
Parameters:
xDataβ pointer to x datayDataβ pointer to y datasizeβ size of x and y
Note: Internally the data is stored in a QwtCPointerData object
setStyle() β set the style π
void QwtPlotCurve::setStyle (CurveStyle style)
Set the curve's drawing style. Slay. π
Parameters:
styleβ Curve style
See also: CurveStyle, style()
setSymbol() β set the symbol π¦
void QwtPlotCurve::setSymbol (const QwtSymbol &symbol)
Assign a symbol. Little icons for days. β¨
Parameters:
symbolβ Symbol
See also: symbol()
style() β get the style π
QwtPlotCurve::CurveStyle QwtPlotCurve::style () const
Return the current style. Iconic. π
See also: CurveStyle, setStyle()
symbol() β get the symbol π
const QwtSymbol & QwtPlotCurve::symbol () const
Return the current symbol. Obsessed. π
See also: setSymbol()
testCurveAttribute() β test curve attribute π§ͺ
bool QwtPlotCurve::testCurveAttribute (CurveAttribute attribute) const
Returns: true, if attribute is enabled
See also: CurveAttribute, setCurveAttribute()
testPaintAttribute() β test paint attribute π¨
bool QwtPlotCurve::testPaintAttribute (PaintAttribute attribute) const
Return the current paint attributes. Knowledge is power. πͺ
See also: PaintAttribute, setPaintAttribute()
x() β get x-value π
double QwtPlotCurve::x (inti) const [inline]
Parameters:
iβ index
Returns: x-value at position i
y() β get y-value π
double QwtPlotCurve::y (inti) const [inline]
Parameters:
iβ index
Returns: y-value at position i
π Author π
Generated automatically by Doxygen for Qwt User's Guide from the source code.
And that's the tea, bestie! This whole page was auto-generated by Doxygen for the Qwt User's Guide from the source code. It's version 5.2.3, dated Tue Nov 20 2012, and it's serving QwtPlotCurve(3) realness. Bye queen! πβ¨π
π¦ where this page comes from
- epel 9: qwt5-qt5-devel 5.2.3a-12.20210522gita2b11e3.el9 Β· LGPLv2+ with exceptions
- fedora 43: qwt5-qt5-devel 5.2.3a-22.20210522gita2b11e3.fc43 Β· LGPL-2.1-or-later WITH Qwt-exception-1.0
- fedora 43: qwt5-qt5-devel 5.2.3a-22.20210522gita2b11e3.fc43 Β· LGPL-2.1-or-later WITH Qwt-exception-1.0
- fedora 44: qwt5-qt5-devel 5.2.3a-23.20210522gita2b11e3.fc44 Β· LGPL-2.1-or-later WITH Qwt-exception-1.0
- fedora 44: qwt5-qt5-devel 5.2.3a-23.20210522gita2b11e3.fc44 Β· LGPL-2.1-or-later WITH Qwt-exception-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms