QwtPlotCurve(3)

πŸ“¦ version 5.2.3a, in epel 9, fedora 43, fedora 44

πŸ¦‹ 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 () const
  • virtual QwtDoubleRect boundingRect () const
  • const QBrush & brush () const
  • int closestPoint (const QPoint &pos, double *dist=NULL) const
  • QwtCurveFitter * curveFitter () const
  • CurveType curveType () const
  • QwtData & data ()
  • const QwtData & data () const
  • int dataSize () 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
  • double maxXValue () const
  • double maxYValue () const
  • double minXValue () const
  • double minYValue () const
  • const QPen & pen () const
  • virtual int rtti () const
  • void 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 () const
  • const QwtSymbol & symbol () const
  • bool testCurveAttribute (CurveAttribute) const
  • bool testPaintAttribute (PaintAttribute) const
  • virtual void updateLegend (QwtLegend *) const
  • double x (int i) const
  • double y (int i) const

🧚 Protected Member Functions

  • void closePolyline (const QwtScaleMap &, const QwtScaleMap &, QwtPolygon &) const
  • virtual void drawCurve (QPainter *p, int style, 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 drawLines (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 drawSticks (QPainter *p, 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 fillCurve (QPainter *, const QwtScaleMap &, const QwtScaleMap &, QwtPolygon &) const
  • void 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

  1. a) Assign curve properties When a curve is created, it is configured to draw black solid lines in Lines style and no symbols. You can change this by calling setPen(), setStyle() and setSymbol().
  2. b) Connect/Assign data. QwtPlotCurve gets its points using a QwtData object offering a bridge to the real storage of the points (like QAbstractItemModel). There are several convenience classes derived from QwtData, that also store the points inside (like QStandardItemModel). QwtPlotCurve also offers a couple of variations of setData(), that build QwtData objects from arrays internally.
  3. 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 the Lines QwtPlotCurve::CurveStyle only) A QwtCurveFitter tries to interpolate/smooth the curve, before it is painted. Note that curve fitting requires temporary memory for calculating coefficients and additional points. If painting in Fitted mode is slow it might be better to fit the points, before they are passed to QwtPlotCurve.
  • Inverted For Steps only. Draws a step function from the right to the left.

See also: setCurveAttribute(), testCurveAttribute(), curveFitter()


πŸ’… enum QwtPlotCurve::CurveStyle

Curve styles. ✨

  • NoCurve Don't draw a curve. Note: This doesn't affect the symbols.
  • Lines Connect the points with straight lines. The lines might be interpolated depending on the 'Fitted' attribute. Curve fitting can be configured using setCurveFitter().
  • Sticks Draw vertical (Yfx) or horizontal (Xfy) sticks from a baseline which is defined by setBaseline().
  • Steps Connect 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.
  • Dots Draw dots at the locations of the data points. Note: This is different from a dotted line (see setPen()), and faster than a curve in NoStyle style with a symbol painting a point.
  • UserCurve Styles >= UserCurve are reserved for derived classes of QwtPlotCurve that overload drawCurve() with additional application specific curve types.

See also: setStyle(), style()


🌈 enum QwtPlotCurve::CurveType

Curve type. πŸ’«

  • Yfx Draws y as a function of x (the default). The baseline is interpreted as a horizontal line with y = baseline().
  • 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.

See also: setCurveType(), curveType(), baseline() brush()


⭐ enum QwtPlotCurve::PaintAttribute

Attributes to modify the drawing algorithm. 🎨

  • PaintFiltered Tries 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.
  • ClipPolygons Clip 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 map
  • yMap β€” Y map
  • pa β€” 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 point
  • dist β€” If dist != 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 β€” Painter
  • xMap β€” 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 β€” Painter
  • xMap β€” maps x-values into pixel coordinates.
  • yMap β€” maps y-values into pixel coordinates.
  • from β€” index of the first point to be painted
  • to β€” index of the last point to be painted. If to < 0 the 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 painted
  • to β€” Index of the last point to be painted. If to < 0 the 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 β€” Painter
  • style β€” curve style, see QwtPlotCurve::CurveStyle
  • xMap β€” x map
  • yMap β€” y map
  • from β€” index of the first point to be painted
  • to β€” 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 β€” Painter
  • xMap β€” x map
  • yMap β€” y map
  • from β€” index of the first point to be painted
  • to β€” 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 β€” Painter
  • xMap β€” x map
  • yMap β€” y map
  • from β€” index of the first point to be painted
  • to β€” 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 β€” Painter
  • xMap β€” x map
  • yMap β€” y map
  • from β€” index of the first point to be painted
  • to β€” 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 β€” Painter
  • xMap β€” x map
  • yMap β€” y map
  • from β€” index of the first point to be painted
  • to β€” 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 β€” Painter
  • symbol β€” Curve symbol
  • xMap β€” x map
  • yMap β€” y map
  • from β€” index of the first point to be painted
  • to β€” 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 β€” Painter
  • xMap β€” x map
  • yMap β€” y map
  • pa β€” 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 attribute
  • on β€” 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 β€” Yfx or Xfy

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 values
  • yData β€” Pointer to y values
  • size β€” Size of xData and yData

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 data
  • yData β€” 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 attribute
  • on β€” 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 data
  • yData β€” pointer to y data
  • size β€” 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