QwtPlotCurve(3)

πŸ’– QwtPlotCurve(3) πŸ’–

okay so this is straight from the Library Functions Manual, and it's the whole QwtPlotCurve moment. It's a plot item, and it represents a series of points. That's the name energy. Periodt.

✨ NAME ✨

QwtPlotCurve β€” a plot item, that represents a series of points. πŸ’…

🌸 SYNOPSIS 🌸

#include <qwt_plot_curve.h>

Inherits QwtPlotSeriesItem, and QwtSeriesStore< QPointF >. yes bestie, it's in the family tree.

πŸŽ€ Public Types πŸŽ€

  • enum CurveStyle β€” { NoCurve = -1, Lines, Sticks, Steps, Dots, UserCurve = 100 } β€” your curve's whole aesthetic.
  • enum CurveAttribute β€” { Inverted = 0x01, Fitted = 0x02 }
  • enum LegendAttribute β€” { LegendNoAttribute = 0x00, LegendShowLine = 0x01, LegendShowSymbol = 0x02, LegendShowBrush = 0x04 }
  • enum PaintAttribute β€” { ClipPolygons = 0x01, FilterPoints = 0x02, MinimizeMemory = 0x04, ImageBuffer = 0x08, FilterPointsAggressive = 0x10 }
  • typedef QFlags< CurveAttribute > CurveAttributes
  • typedef QFlags< LegendAttribute > LegendAttributes
  • typedef QFlags< PaintAttribute > PaintAttributes

πŸ’œ Public Types inherited from QwtPlotItem πŸ’œ

  • enum RttiValues β€” { Rtti_PlotItem = 0, Rtti_PlotGrid, Rtti_PlotScale, Rtti_PlotLegend, Rtti_PlotMarker, Rtti_PlotCurve, Rtti_PlotSpectroCurve, Rtti_PlotIntervalCurve, Rtti_PlotHistogram, Rtti_PlotSpectrogram, Rtti_PlotGraphic, Rtti_PlotTradingCurve, Rtti_PlotBarChart, Rtti_PlotMultiBarChart, Rtti_PlotShape, Rtti_PlotTextLabel, Rtti_PlotZone, Rtti_PlotVectorField, Rtti_PlotUserItem = 1000 } β€” Runtime type information.
  • enum ItemAttribute β€” { Legend = 0x01, AutoScale = 0x02, Margins = 0x04 } β€” Plot Item Attributes.
  • enum ItemInterest β€” { ScaleInterest = 0x01, LegendInterest = 0x02 } β€” Plot Item Interests.
  • enum RenderHint β€” { RenderAntialiased = 0x1 } β€” Render hints.
  • typedef QFlags< ItemAttribute > ItemAttributes
  • typedef QFlags< ItemInterest > ItemInterests
  • typedef QFlags< RenderHint > RenderHints

πŸ¦‹ Public Member Functions πŸ¦‹

  • QwtPlotCurve (const QString &title=QString()) β€” constructor, title optional.
  • QwtPlotCurve (const QwtText &title) β€” constructor with a QwtText title.
  • virtual ~QwtPlotCurve () β€” Destructor.
  • virtual int rtti () const override β€” runtime type info, override style.
  • void setPaintAttribute (PaintAttribute, bool on=true) β€” set a paint attribute, default on=true.
  • bool testPaintAttribute (PaintAttribute) const β€” check a paint attribute.
  • void setLegendAttribute (LegendAttribute, bool on=true) β€” set a legend attribute, default on=true.
  • bool testLegendAttribute (LegendAttribute) const β€” check a legend attribute.
  • void setLegendAttributes (LegendAttributes) β€” set the whole legend attribute set.
  • LegendAttributes legendAttributes () const β€” get the legend attributes.
  • void setRawSamples (const double *xData, const double *yData, int size) β€” Initialize the data by pointing to memory blocks which are not managed by QwtPlotCurve.
  • void setRawSamples (const float *xData, const float *yData, int size) β€” Initialize the data by pointing to memory blocks which are not managed by QwtPlotCurve.
  • void setRawSamples (const double *yData, int size) β€” Initialize the data by pointing to a memory block which is not managed by QwtPlotCurve.
  • void setRawSamples (const float *yData, int size) β€” Initialize the data by pointing to memory blocks which are not managed by QwtPlotCurve.
  • void setSamples (const double *xData, const double *yData, int size) β€” set size samples from xData and yData.
  • void setSamples (const float *xData, const float *yData, int size) β€” set size samples from xData and yData, float version.
  • void setSamples (const double *yData, int size) β€” set size samples from a y-only double array.
  • void setSamples (const float *yData, int size) β€” set size samples from a y-only float array.
  • void setSamples (const QVector< double > &yData) β€” set samples from a y-only vector of doubles.
  • void setSamples (const QVector< float > &yData) β€” set samples from a y-only vector of floats.
  • void setSamples (const QVector< double > &xData, const QVector< double > &yData) β€” Initialize data with x- and y-arrays (explicitly shared).
  • void setSamples (const QVector< float > &xData, const QVector< float > &yData) β€” Initialize data with x- and y-arrays (explicitly shared).
  • void setSamples (const QVector< QPointF > &) β€” set samples from a point vector.
  • void setSamples (QwtSeriesData< QPointF > *) β€” set samples from a QwtSeriesData< QPointF > pointer.
  • virtual int closestPoint (const QPointF &pos, double *dist=NULL) const β€” closest point, optional dist pointer defaults to NULL.
  • virtual int adjacentPoint (Qt::Orientation orientation, qreal value) const β€” adjacent point by orientation and value.
  • qreal interpolatedValueAt (Qt::Orientation, double) const β€” interpolated value at orientation and double.
  • double minXValue () const β€” boundingRect().left()
  • double maxXValue () const β€” boundingRect().right()
  • double minYValue () const β€” boundingRect().top()
  • double maxYValue () const β€” boundingRect().bottom()
  • void setCurveAttribute (CurveAttribute, bool on=true) β€” set a curve attribute, default on=true.
  • bool testCurveAttribute (CurveAttribute) const β€” check a curve attribute.
  • void setPen (const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine) β€” pen from color, width defaults to 0.0, style defaults to Qt::SolidLine.
  • void setPen (const QPen &) β€” pen from a QPen.
  • const QPen & pen () const β€” get the pen.
  • void setBrush (const QBrush &) β€” Assign a brush.
  • const QBrush & brush () const β€” get the brush.
  • void setBaseline (double) β€” Set the value of the baseline.
  • double baseline () const β€” get the baseline.
  • void setStyle (CurveStyle style) β€” set the curve style.
  • CurveStyle style () const β€” get the curve style.
  • void setSymbol (QwtSymbol *) β€” Assign a symbol.
  • const QwtSymbol * symbol () const β€” get the symbol pointer.
  • void setCurveFitter (QwtCurveFitter *) β€” set a curve fitter.
  • QwtCurveFitter * curveFitter () const β€” get the curve fitter.
  • virtual void drawSeries (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const override β€” draw the series, override.
  • virtual QwtGraphic legendIcon (int index, const QSizeF &) const override β€” legend icon for an index and size, override.

🫢 Public Member Functions inherited from QwtPlotSeriesItem 🫢

  • QwtPlotSeriesItem (const QString &title=QString()) β€” constructor, optional title.
  • QwtPlotSeriesItem (const QwtText &title) β€” constructor with a QwtText title.
  • virtual ~QwtPlotSeriesItem () β€” Destructor.
  • void setOrientation (Qt::Orientation) β€” set orientation.
  • Qt::Orientation orientation () const β€” get orientation.
  • virtual void draw (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const override β€” Draw the complete series.
  • virtual QRectF boundingRect () const override β€” bounding rect, override.
  • virtual void updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &) override β€” Update the item to changes of the axes scale division.

πŸ‘‘ Public Member Functions inherited from QwtPlotItem πŸ‘‘

  • QwtPlotItem () β€” constructor.
  • QwtPlotItem (const QString &title) β€” constructor with a title.
  • QwtPlotItem (const QwtText &title) β€” constructor with a QwtText title.
  • virtual ~QwtPlotItem () β€” Destroy the QwtPlotItem.
  • void attach (QwtPlot *plot) β€” Attach the item to a plot.
  • void detach () β€” This method detaches a QwtPlotItem from any QwtPlot it has been associated with.
  • QwtPlot * plot () const β€” Return attached plot.
  • void setTitle (const QString &title) β€” set title from a string.
  • void setTitle (const QwtText &title) β€” set title from QwtText.
  • const QwtText & title () const β€” get the title.
  • void setItemAttribute (ItemAttribute, bool on=true) β€” set item attribute, default on=true.
  • bool testItemAttribute (ItemAttribute) const β€” check item attribute.
  • void setItemInterest (ItemInterest, bool on=true) β€” set item interest, default on=true.
  • bool testItemInterest (ItemInterest) const β€” check item interest.
  • void setRenderHint (RenderHint, bool on=true) β€” set render hint, default on=true.
  • bool testRenderHint (RenderHint) const β€” check render hint.
  • void setRenderThreadCount (uint numThreads) β€” set render thread count.
  • uint renderThreadCount () const β€” get render thread count.
  • void setLegendIconSize (const QSize &) β€” set legend icon size.
  • QSize legendIconSize () const β€” get legend icon size.
  • double z () const β€” get z.
  • void setZ (double z) β€” Set the z value.
  • void show () β€” Show the item.
  • void hide () β€” Hide the item.
  • virtual void setVisible (bool) β€” set visibility.
  • bool isVisible () const β€” check visibility.
  • void setAxes (QwtAxisId xAxis, QwtAxisId yAxis) β€” set both axes.
  • void setXAxis (QwtAxisId) β€” set x axis.
  • QwtAxisId xAxis () const β€” Return xAxis.
  • void setYAxis (QwtAxisId) β€” set y axis.
  • QwtAxisId yAxis () const β€” Return yAxis.
  • virtual void itemChanged () β€” item changed hook.
  • virtual void legendChanged () β€” legend changed hook.
  • virtual void getCanvasMarginHint (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) const β€” Calculate a hint for the canvas margin.
  • virtual void updateLegend (const QwtPlotItem *, const QList< QwtLegendData > &) β€” Update the item to changes of the legend info.
  • QRectF scaleRect (const QwtScaleMap &, const QwtScaleMap &) const β€” Calculate the bounding scale rectangle of 2 maps.
  • QRectF paintRect (const QwtScaleMap &, const QwtScaleMap &) const β€” Calculate the bounding paint rectangle of 2 maps.
  • virtual QList< QwtLegendData > legendData () const β€” Return all information, that is needed to represent the item on the legend.

🧚 Public Member Functions inherited from QwtAbstractSeriesStore 🧚

  • virtual ~QwtAbstractSeriesStore () β€” Destructor.

πŸ“ Public Member Functions inherited from QwtSeriesStore< QPointF > πŸ“

  • QwtSeriesStore () β€” Constructor. The store contains no series.
  • ~QwtSeriesStore () β€” Destructor.
  • void setData (QwtSeriesData< QPointF > *series) β€” set the data pointer.
  • QwtSeriesData< QPointF > * data () β€” get the data pointer.
  • QPointF sample (int index) const β€” sample at index.
  • virtual size_t dataSize () const override β€” data size, override.
  • virtual QRectF dataRect () const override β€” data rect, override.
  • virtual void setRectOfInterest (const QRectF &rect) override β€” set rect of interest, override.
  • QwtSeriesData< QPointF > * swapData (QwtSeriesData< QPointF > *series) β€” swap data.

πŸ›‘οΈ Protected Member Functions πŸ›‘οΈ

  • void init () β€” Initialize internal members.
  • virtual void drawCurve (QPainter *, int style, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const β€” Draw the line part (without symbols) of a curve interval.
  • virtual void drawSymbols (QPainter *, const QwtSymbol &, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const β€” draw symbols over the interval.
  • virtual void drawLines (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const β€” Draw lines.
  • virtual void drawSticks (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const β€” draw sticks.
  • virtual void drawDots (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const β€” draw dots.
  • virtual void drawSteps (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const β€” draw steps.
  • virtual void fillCurve (QPainter *, const QwtScaleMap &, const QwtScaleMap &, const QRectF &canvasRect, QPolygonF &) const β€” fill curve.
  • void closePolyline (QPainter *, const QwtScaleMap &, const QwtScaleMap &, QPolygonF &) const β€” Complete a polygon to be a closed polygon including the area between the original polygon and the baseline.

πŸ’€ Protected Member Functions inherited from QwtPlotSeriesItem πŸ’€

  • virtual void dataChanged () override β€” dataChanged() indicates, that the series has been changed.

πŸ’œ Protected Member Functions inherited from QwtPlotItem πŸ’œ

  • QwtGraphic defaultIcon (const QBrush &, const QSizeF &) const β€” Return a default icon from a brush.

Detailed Description ✨

A plot item that's literally a whole series of points, bestie. πŸ’…

A curve is the representation of a series of points in the x-y plane. It supports different display styles, interpolation ( f.e. spline ) and symbols. It's giving versatility, honestly.

Usage πŸŽ€

a) Assign curve properties

When a curve is created, it is configured to draw black solid lines with in QwtPlotCurve::Lines style and no symbols. You can change this by calling setPen(), setStyle() and setSymbol(). Slay β€” you get to pick the whole aesthetic.

b) Connect/Assign data.

QwtPlotCurve gets its points using a QwtSeriesData object offering a bridge to the real storage of the points ( like QAbstractItemModel ). There are several convenience classes derived from QwtSeriesData, that also store the points inside ( like QStandardItemModel ). QwtPlotCurve also offers a couple of variations of setSamples(), that build QwtSeriesData objects from arrays internally. Translations: you don't have to hand it a fancy model, it can build one for you. πŸ’–

c) Attach the curve to a plot

See QwtPlotItem::attach()

Example: see examples/bode
See also: QwtPointSeriesData, QwtSymbol, QwtScaleMap

Definition at line 56 of file qwt_plot_curve.h.


Member Typedef Documentation 🌸

typedef QFlags<CurveAttribute> QwtPlotCurve::CurveAttributes

An ORed combination of CurveAttribute values. Like, mix and match your flags, no cap.

Definition at line 133 of file qwt_plot_curve.h.

typedef QFlags<LegendAttribute> QwtPlotCurve::LegendAttributes

An ORed combination of LegendAttribute values. Yes bestie, same deal. ✨

Definition at line 168 of file qwt_plot_curve.h.

typedef QFlags<PaintAttribute> QwtPlotCurve::PaintAttributes

An ORed combination of PaintAttribute values. Three for three, we love a consistent icon. πŸ‘‘

Definition at line 234 of file qwt_plot_curve.h.


Member Enumeration Documentation πŸ”₯

enum QwtPlotCurve::CurveAttribute

Attribute for drawing the curve. Little toggles that change how it's drawn, iykyk.

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

Enumerator

  • Inverted β€” For QwtPlotCurve::Steps only. Draws a step function from the right to the left.
  • Fitted β€” Only in combination with QwtPlotCurve::Lines. A QwtCurveFitter tries to interpolate/smooth the curve, before it is painted.
Note: Curve fitting requires temporary memory for calculating coefficients and additional points. If painting in QwtPlotCurve::Fitted mode is slow it might be better to fit the points, before they are passed to QwtPlotCurve. Like, do the homework ahead of time so the paint step isn't stressed. 😭

Definition at line 112 of file qwt_plot_curve.h.

enum QwtPlotCurve::CurveStyle

Curve styles. Pick your vibe. πŸ¦‹

See also: setStyle(), style()

Enumerator

  • 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 or horizontal sticks ( depending on the orientation() ) 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 QwtPlotCurve::Inverted attribute.
  • Dots β€” Draw dots at the locations of the data points. Note: This is different from a dotted line (see setPen()), and faster as a curve in QwtPlotCurve::NoStyle style and a symbol painting a point.
  • UserCurve β€” Styles >= QwtPlotCurve::UserCurve are reserved for derived classes of QwtPlotCurve that overload drawCurve() with additional application specific curve types. Reserved territory, bestie β€” that's for your own subclasses. πŸ’œ

Definition at line 65 of file qwt_plot_curve.h.

enum QwtPlotCurve::LegendAttribute

Attributes how to represent the curve on the legend. Basically: what does your little legend swatch look like. πŸŽ€

See also: setLegendAttribute(), testLegendAttribute(), QwtPlotItem::legendData(), legendIcon()

Enumerator

  • LegendNoAttribute β€” QwtPlotCurve tries to find a color representing the curve and paints a rectangle with it.
  • LegendShowLine β€” If the style() is not QwtPlotCurve::NoCurve a line is painted with the curve pen().
  • LegendShowSymbol β€” If the curve has a valid symbol it is painted.
  • LegendShowBrush β€” If the curve has a brush a rectangle filled with the curve brush() is painted.

Definition at line 142 of file qwt_plot_curve.h.

enum QwtPlotCurve::PaintAttribute

Attributes to modify the drawing algorithm. The default setting enables ClipPolygons | FilterPoints. That's the starter pack, and honestly it's a good one. ✨

See also: setPaintAttribute(), testPaintAttribute()

Enumerator

  • 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.
  • FilterPoints β€” 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 algorithms are implemented.
  • MinimizeMemory β€” Minimize memory usage that is temporarily needed for the translated points, before they get painted. This might slow down the performance of painting. Trade-off city, population: your curve. 😭
  • ImageBuffer β€” Render the points to a temporary image and paint the image. This is a very special optimization for Dots style, when having a huge amount of points. With a reasonable number of points QPainter::drawPoints() will be faster.
  • FilterPointsAggressive β€” More aggressive point filtering trying to filter out intermediate points, accepting minor visual differences.

Has only an effect, when drawing the curve to a paint device in integer coordinates ( f.e. all widgets on screen ) using the fact, that consecutive points are often mapped to the same x or y coordinate. Each chunk of samples mapped to the same coordinate can be reduced to 4 points ( first, min, max last ).

In the worst case the polygon to be rendered will be 4 times the width of the plot canvas.

The algorithm is very fast and effective for huge datasets, and can be used inside a replot cycle.

Note: Implemented for QwtPlotCurve::Lines only. And listen β€” as this algo replaces many small lines by a long one a nasty bug of the raster paint engine ( Qt 4.8, Qt 5.1 - 5.3 ) becomes more dominant. For these versions the bug can be worked around by enabling the QwtPainter::polylineSplitting() mode. Genuinely important, don't skip that one. πŸ’€

Definition at line 176 of file qwt_plot_curve.h.


Constructor & Destructor Documentation πŸ’…

QwtPlotCurve::QwtPlotCurve (const QString & title = QString()) [explicit]

Constructor. Your main character origin story. πŸ‘‘

Parameters

  • title β€” Title of the curve

Definition at line 123 of file qwt_plot_curve.cpp.

QwtPlotCurve::QwtPlotCurve (const QwtText & title) [explicit]

Constructor. Same energy, but the title comes in as a QwtText.

Parameters

  • title β€” Title of the curve

Definition at line 113 of file qwt_plot_curve.cpp.

QwtPlotCurve::~QwtPlotCurve () [virtual]

Destructor. Say bye bestie, it's giving closure. πŸ¦‹

Definition at line 130 of file qwt_plot_curve.cpp.


Member Function Documentation 🌈

int QwtPlotCurve::adjacentPoint (Qt::Orientation orientation, qreal value) const [virtual]

Find the curve point with the smallest coordinate larger than a specific value. The coordinates have to be monotonic in direction of the orientation. So like, sorted, or this whole thing falls apart β€” fr fr.

Parameters

  • orientation β€” Qt::Horizontal corresponds to x, Qt::Vertical to y coordinates
  • value β€” x or y coordinate, depending on the orientation

Returns

Index of the curve point with the smalles coordinate above value or -1 if there is none.

Note: The implementation uses a binary search algorithm and requires the points being ordered in direction of the orientation.
See also: qwtUpperSampleIndex()

Definition at line 1108 of file qwt_plot_curve.cpp.

double QwtPlotCurve::baseline () const

Returns

Value of the baseline

See also: setBaseline()

Definition at line 1038 of file qwt_plot_curve.cpp.

const QBrush & QwtPlotCurve::brush () const

Returns

Brush used to fill the area between lines and the baseline

See also: setBrush(), setBaseline(), baseline()

Definition at line 366 of file qwt_plot_curve.cpp.

void QwtPlotCurve::closePolyline (QPainter * painter, const QwtScaleMap & xMap, const QwtScaleMap & yMap, QPolygonF & polygon) const [protected]

Complete a polygon to be a closed polygon including the area between the original polygon and the baseline. Tying the lil ribbon on the shape, basically. πŸŽ€

Parameters

  • painter β€” Painter
  • xMap β€” X map
  • yMap β€” Y map
  • polygon β€” Polygon to be completed

Definition at line 932 of file qwt_plot_curve.cpp.

int QwtPlotCurve::closestPoint (const QPointF & pos, double * dist = NULL) const [virtual]

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 in paint device coordinates

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. Not me calling it dumb, that's literally what the docs say 😭 β€” it's just not fancy, but it works.

Definition at line 1054 of file qwt_plot_curve.cpp.

QwtCurveFitter * QwtPlotCurve::curveFitter () const

Get the curve fitter. If curve fitting is disabled NULL is returned.

Returns

Curve fitter

See also: setCurveFitter(), Fitted

Definition at line 875 of file qwt_plot_curve.cpp.

void QwtPlotCurve::drawCurve (QPainter * painter, int style, const QwtScaleMap & xMap, const QwtScaleMap & yMap, const QRectF & canvasRect, int from, int to) const [protected], [virtual]

Draw the line part (without symbols) of a curve interval. Just the line, bestie β€” the symbols are a whole separate situation.

Parameters

  • painter β€” Painter
  • style β€” curve style, see QwtPlotCurve::CurveStyle
  • xMap β€” x map
  • yMap β€” y map
  • canvasRect β€” Contents rectangle of the canvas
  • 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()

Definition at line 432 of file qwt_plot_curve.cpp.

void QwtPlotCurve::drawDots (QPainter * painter, const QwtScaleMap & xMap, const QwtScaleMap & yMap, const QRectF & canvasRect, int from, int to) const [protected], [virtual]

Draw dots. Lil dots. Iconic, honestly. πŸ’–

Parameters

  • painter β€” Painter
  • xMap β€” x map
  • yMap β€” y map
  • canvasRect β€” Contents rectangle of the canvas
  • 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()

Definition at line 643 of file qwt_plot_curve.cpp.

drawLines β€” protected, virtual

void QwtPlotCurve::drawLines(QPainter *painter, const QwtScaleMap &xMap,
    const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const

okay so this one literally draws the lines πŸ’…. And the tea: if the Fitted CurveAttribute is switched on, a QwtCurveFitter swoops in and tries to interpolate/smooth the curve before it gets painted. cute, right?

  • painter β€” the Painter
  • xMap β€” x map
  • yMap β€” y map
  • canvasRect β€” contents rectangle of the canvas
  • 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()

Definition at line 479 of file qwt_plot_curve.cpp.


drawSeries β€” override, virtual

void QwtPlotCurve::drawSeries(QPainter *painter, const QwtScaleMap &xMap,
    const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const

Draws an interval of the curve ✨ β€” like, just the slice you asked for, not the whole thing.

  • painter β€” the Painter
  • xMap β€” maps x-values into pixel coordinates
  • yMap β€” maps y-values into pixel coordinates
  • canvasRect β€” contents rectangle of the canvas
  • 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()

Implements QwtPlotSeriesItem.

Definition at line 384 of file qwt_plot_curve.cpp.


drawSteps β€” protected, virtual

void QwtPlotCurve::drawSteps(QPainter *painter, const QwtScaleMap &xMap,
    const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const

Draws a step function πŸͺœ β€” the staircase vibe, we love her.

The direction of the steps depends on the Inverted attribute, just so you know.

  • painter β€” the Painter
  • xMap β€” x map
  • yMap β€” y map
  • canvasRect β€” contents rectangle of the canvas
  • 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()

Definition at line 744 of file qwt_plot_curve.cpp.


drawSticks β€” protected, virtual

void QwtPlotCurve::drawSticks(QPainter *painter, const QwtScaleMap &xMap,
    const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const

Draws sticks πŸ₯’ β€” yes that's really the name, she's giving lollipop-chart energy.

  • painter β€” the Painter
  • xMap β€” x map
  • yMap β€” y map
  • canvasRect β€” contents rectangle of the canvas
  • 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()

Definition at line 588 of file qwt_plot_curve.cpp.


drawSymbols β€” protected, virtual

void QwtPlotCurve::drawSymbols(QPainter *painter, const QwtSymbol &symbol,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect,
    int from, int to) const

Draws the symbols πŸŽ€ β€” the little markers sitting on your points, the moment of glamour.

  • painter β€” the Painter
  • symbol β€” curve symbol
  • xMap β€” x map
  • yMap β€” y map
  • canvasRect β€” contents rectangle of the canvas
  • from β€” index of the first point to be painted
  • to β€” index of the last point to be painted

See also: setSymbol(), drawSeries(), drawCurve()

Definition at line 982 of file qwt_plot_curve.cpp.


fillCurve β€” protected, virtual

void QwtPlotCurve::fillCurve(QPainter *painter, const QwtScaleMap &xMap,
    const QwtScaleMap &yMap, const QRectF &canvasRect,
    QPolygonF &polygon) const

Fills the area between the curve and the baseline with the curve brush 🌸 β€” the under-the-curve glow-up.

  • painter β€” the Painter
  • xMap β€” x map
  • yMap β€” y map
  • canvasRect β€” contents rectangle of the canvas
  • polygon β€” Polygon β€” will be modified ! ⚠️ like, it does not come back the same, bestie

See also: setBrush(), setBaseline(), setStyle()

Definition at line 892 of file qwt_plot_curve.cpp.


init β€” protected

void QwtPlotCurve::init()

Initialize internal members πŸ”§ β€” the behind-the-scenes setup, not the main character but doing the work.

Definition at line 136 of file qwt_plot_curve.cpp.


interpolatedValueAt

qreal QwtPlotCurve::interpolatedValueAt(Qt::Orientation orientation,
    double value) const

Calculates a fictive curve point by interpolating between the adjacent points πŸ’«. Heads up: the curve points have to be monotonic in the direction of the orientation, fr fr.

  • orientation β€” for Qt::Horizontal, value is a x coordinate and a y coordinate is returned. For Qt::Vertical, value is a x coordinate value x or y coordinate, depending on the orientation
  • value β€” (as described above, it's the coordinate you're feeding in)

Returns: Interpolated coordinate or qQNaN() if value is outside the bounding rectangle of the curve 😭

Note: the implementation uses a binary search algorithm and requires the points to be ordered in the direction of the orientation. Out of order? She will not find your point. Periodt.

See also: adjacentPoint()

Definition at line 1158 of file qwt_plot_curve.cpp.


legendAttributes

QwtPlotCurve::LegendAttributes QwtPlotCurve::legendAttributes() const

Returns: Attributes how to draw the legend icon πŸ‘‘

See also: setLegendAttributes(), testLegendAttribute()

Definition at line 228 of file qwt_plot_curve.cpp.


legendIcon β€” override, virtual

QwtGraphic QwtPlotCurve::legendIcon(int index, const QSizeF &size) const

Returns: Icon representing the curve on the legend πŸ–ΌοΈβœ¨

  • index β€” index of the legend entry (ignored, as there is only one)
  • size β€” icon size

See also: QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()

Reimplemented from QwtPlotItem.

Definition at line 1223 of file qwt_plot_curve.cpp.


maxXValue β€” inline

double QwtPlotCurve::maxXValue() const

Literally just boundingRect().right() β€” that's it, that's the whole function πŸ’β€β™€οΈ

Definition at line 358 of file qwt_plot_curve.h.


maxYValue β€” inline

double QwtPlotCurve::maxYValue() const

It's boundingRect().bottom(). simple as πŸ“

Definition at line 370 of file qwt_plot_curve.h.


minXValue β€” inline

double QwtPlotCurve::minXValue() const

Returns boundingRect().left(). iconic, no notes.

Definition at line 352 of file qwt_plot_curve.h.


minYValue β€” inline

double QwtPlotCurve::minYValue() const

Returns boundingRect().top(). that's the vibe check βœ…

Definition at line 364 of file qwt_plot_curve.h.


pen

const QPen &QwtPlotCurve::pen() const

Returns: Pen used to draw the lines πŸ–ŠοΈπŸ’–

See also: setPen(), brush()

Definition at line 331 of file qwt_plot_curve.cpp.


rtti β€” override, virtual

int QwtPlotCurve::rtti() const

Returns: QwtPlotItem::Rtti_PlotCurve β€” her official ID, no cap πŸͺͺ

Reimplemented from QwtPlotItem.

Definition at line 148 of file qwt_plot_curve.cpp.


setBaseline

void QwtPlotCurve::setBaseline(double value)

Sets the value of the baseline πŸ“. The baseline is needed for filling the curve with a brush, or for the Sticks drawing style. So like, if you're doing either of those, this matters.

The interpretation of the baseline depends on the orientation(). With Qt::Vertical, the baseline is interpreted as a horizontal line at y = baseline(); with Qt::Horizontal, it's interpreted as a vertical line at x = baseline().

The default value is 0.0.

  • value β€” value of the baseline

See also: baseline(), setBrush(), setStyle(), QwtPlotAbstractSeriesItem::orientation()

Definition at line 1025 of file qwt_plot_curve.cpp.


setBrush

void QwtPlotCurve::setBrush(const QBrush &brush)

Assigns 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). Unsorted data = chaos = not the look.
  • brush β€” new brush

See also: brush(), setBaseline(), baseline()

Definition at line 351 of file qwt_plot_curve.cpp.


setCurveAttribute

void QwtPlotCurve::setCurveAttribute(CurveAttribute attribute,
    bool on = true)

Specifies an attribute for drawing the curve ✨

  • attribute β€” curve attribute
  • on β€” On/Off

/sa testCurveAttribute(), setCurveFitter()

Definition at line 822 of file qwt_plot_curve.cpp.


setCurveFitter

void QwtPlotCurve::setCurveFitter(QwtCurveFitter *curveFitter)

Assigns a curve fitter 🧚. The curve fitter "smooths" the curve points, when the Fitted CurveAttribute is set. And psst β€” setCurveFitter(NULL) also disables curve fitting.

The curve fitter operates on the translated points (= widget coordinates) so it works for logarithmic scales. Obviously this is less performant for fitting algorithms that reduce the number of points. (Trade-offs, she contains multitudes.)

For situations where curve fitting is used to improve the performance of painting huge series of points, it might be better to execute the fitter on the curve points once and to cache the result in the QwtSeriesData object. big-brain move, tbh.

  • curveFitter() β€” curve fitter

See also: Fitted

Definition at line 861 of file qwt_plot_curve.cpp.


setLegendAttribute

void QwtPlotCurve::setLegendAttribute(LegendAttribute attribute,
    bool on = true)

Specifies an attribute how to draw the legend icon πŸ‘‘βœ¨

  • attribute β€” attribute
  • on β€” On/Off
  • /sa testLegendAttribute(). legendIcon()

Definition at line 184 of file qwt_plot_curve.cpp.


setLegendAttributes

void QwtPlotCurve::setLegendAttributes(LegendAttributes attributes)

Specifies the attributes how to draw the legend icon 🌈 β€” plural, she's doing all of them at once.

  • attributes β€” attributes
  • /sa setLegendAttribute(). legendIcon()

Definition at line 213 of file qwt_plot_curve.cpp.


setPaintAttribute

void QwtPlotCurve::setPaintAttribute(PaintAttribute attribute,
    bool on = true)

Specifies an attribute how to draw the curve 🎨

  • attribute β€” paint attribute
  • on β€” On/Off

See also: testPaintAttribute()

Definition at line 160 of file qwt_plot_curve.cpp.


setPen (colour version)

void QwtPlotCurve::setPen(const QColor &color, qreal width = 0.0,
    Qt::PenStyle style = Qt::SolidLine)

Builds and assigns a pen πŸ–ŠοΈπŸ’…

Okay so important lore: in Qt5 the default pen width is 1.0 (0.0 in Qt4), which makes it non cosmetic (see QPen::isCosmetic()). This method has been introduced to hide this incompatibility. So, historicalQt tea, but useful.

  • color β€” pen color
  • width β€” pen width
  • style β€” pen style

See also: pen(), brush()

Definition at line 305 of file qwt_plot_curve.cpp.


setPen (QPen version)

void QwtPlotCurve::setPen(const QPen &pen)

Assigns a pen πŸ–ŠοΈ β€” the direct route, if you already built one.

  • pen β€” new pen

See also: pen(), brush()

Definition at line 316 of file qwt_plot_curve.cpp.


setRawSamples

void QwtPlotCurve::setRawSamples(const double *xData, const double *yData,
    int size)

Initializes the data by pointing to memory blocks which are not managed by QwtPlotCurve 😳. setRawSamples is provided for efficiency. It is important to keep the pointers during the lifetime of the underlying QwtCPointerData class β€” meaning if those memory blocks dip out, you've got a dangling situation. No cap, be careful.

  • xData β€” pointer to x data
  • yData β€” pointer to y data
  • size β€” size of x and y

See also: QwtCPointerData

Definition at line 1331 of file qwt_plot_curve.cpp.

okay bestie, final lap of the member-function lore πŸ’…βœ¨ β€” sample setup, style glow-ups, and the tiny test* checks. all facts, no cap.

void QwtPlotCurve::setRawSamples (const double * yData, int size)

so this one points your curve at a raw memory block that QwtPlotCurve does not manage 🫢. the block holds the y coordinates, and the index is interpreted as the x coordinate. setRawSamples() is provided for efficiency, and it is important to keep the pointers during the lifetime of the underlying QwtCPointerValueData class. keep those pointers alive, bestie β€” no dangling vibes 😭.

  • yData β€” pointer to y data
  • size β€” size of x and y

See also: QwtCPointerData

Definition: line 1373 of file qwt_plot_curve.cpp.

void QwtPlotCurve::setRawSamples (const float * xData, const float * yData, int size)

this overload points at memory blocks that are not managed by QwtPlotCurve, and yeah, setRawSamples is provided for efficiency. it is important to keep the pointers during the lifetime of the underlying QwtCPointerData class. no cap, this is the zero-copy-ish shortcut energy πŸ”₯.

  • xData β€” pointer to x data
  • yData β€” pointer to y data
  • size β€” size of x and y

See also: QwtCPointerData

Definition: line 1351 of file qwt_plot_curve.cpp.

void QwtPlotCurve::setRawSamples (const float * yData, int size)

same raw-pointer situation, but float-coded this time πŸ’…. it points to memory blocks that are not managed by QwtPlotCurve; the memory contains the y coordinates, while the index is interpreted as x coordinate. setRawSamples() is provided for efficiency, and it is important to keep the pointers during the lifetime of the underlying QwtCPointerValueData class. hold onto those pointers, fr fr 🫢.

  • yData β€” pointer to y data
  • size β€” size of x and y

See also: QwtCPointerData

Definition: line 1394 of file qwt_plot_curve.cpp.

void QwtPlotCurve::setSamples (const double * xData, const double * yData, int size)

set data by copying x- and y-values from specified memory blocks. contrary to setRawSamples(), this function makes a 'deep copy' of the data πŸŽ€. so your original arrays can live their life; the curve has its own copy now.

  • xData β€” pointer to x values
  • yData β€” pointer to y values
  • size β€” size of xData and yData

See also: QwtPointArrayData

Definition: line 1410 of file qwt_plot_curve.cpp.

void QwtPlotCurve::setSamples (const double * yData, int size)

set data by copying y-values from a specified memory block. the memory contains the y coordinates, while the index is interpreted as x coordinate. deep-copy energy, but only for the y side πŸ’–.

  • yData β€” y data
  • size β€” size of yData

See also: QwtValuePointData

Definition: line 1472 of file qwt_plot_curve.cpp.

void QwtPlotCurve::setSamples (const float * xData, const float * yData, int size)

float version of the deep-copy moment ✨. set data by copying x- and y-values from specified memory blocks. contrary to setRawSamples(), this function makes a 'deep copy' of the data.

  • xData β€” pointer to x values
  • yData β€” pointer to y values
  • size β€” size of xData and yData

See also: QwtPointArrayData

Definition: line 1427 of file qwt_plot_curve.cpp.

void QwtPlotCurve::setSamples (const float * yData, int size)

set data by copying y-values from a specified memory block. the vector contains the y coordinates, while the index is interpreted as x coordinate. yes bestie, it says vector here β€” copy that exact vibe πŸ“.

  • yData β€” y data
  • size β€” size of yData

See also: QwtValuePointData

Definition: line 1488 of file qwt_plot_curve.cpp.

void QwtPlotCurve::setSamples (const QVector< double > & xData, const QVector< double > & yData)

initialize data with x- and y-arrays (explicitly shared) πŸ’«. it's giving "clean Qt container energy."

  • xData β€” x data
  • yData β€” y data

See also: QwtPointArrayData

Definition: line 1441 of file qwt_plot_curve.cpp.

void QwtPlotCurve::setSamples (const QVector< double > & yData)

initialize data with an array of y values (explicitly shared). the vector contains the y coordinates, while the index is the x coordinate. iconic single-vector shortcut πŸŽ€.

  • yData β€” y data

See also: QwtValuePointData

Definition: line 1503 of file qwt_plot_curve.cpp.

void QwtPlotCurve::setSamples (const QVector< float > & xData, const QVector< float > & yData)

initialize data with x- and y-arrays (explicitly shared). float containers, same explicitly-shared slay 🌸.

  • xData β€” x data
  • yData β€” y data

See also: QwtPointArrayData

Definition: line 1455 of file qwt_plot_curve.cpp.

void QwtPlotCurve::setSamples (const QVector< float > & yData)

initialize data with an array of y values (explicitly shared). the vector contains the y coordinates, while the index is the x coordinate. one vector, all the y-vibes πŸ’œ.

  • yData β€” y data

See also: QwtValuePointData

Definition: line 1518 of file qwt_plot_curve.cpp.

void QwtPlotCurve::setSamples (const QVector< QPointF > & samples)

initialize data with an array of points πŸ¦‹. yes, actual points, not just loose coordinates.

  • samples β€” Vector of points

Note:

  • QVector is implicitly shared
  • QPolygonF is derived from QVector<QPointF>

Definition: line 1312 of file qwt_plot_curve.cpp.

void QwtPlotCurve::setSamples (QwtSeriesData< QPointF > * data)

assign a series of points. setSamples() is just a wrapper for setData() without any additional value - beside that it is easier to find for the developer. lowkey a convenience icon πŸ‘‘.

  • data β€” Data
Warning: The item takes ownership of the data object, deleting it when its not used anymore.

Definition: line 1300 of file qwt_plot_curve.cpp.

void QwtPlotCurve::setStyle (CurveStyle style)

set the curve's drawing style πŸ’…. this is the main-character glow-up for how the curve shows up.

  • style β€” Curve style

See also: style()

Definition: line 239 of file qwt_plot_curve.cpp.

void QwtPlotCurve::setSymbol (QwtSymbol * symbol)

assign a symbol. the curve will take the ownership of the symbol, hence the previously set symbol will be delete by setting a new one. if symbol is NULL no symbol will be drawn. ownership transfer, bestie β€” don't double-delete πŸ™ˆ.

  • symbol β€” Symbol

See also: symbol()

Definition: line 269 of file qwt_plot_curve.cpp.

QwtPlotCurve::CurveStyle QwtPlotCurve::style () const

Returns: Style of the curve

See also: setStyle()

Definition: line 254 of file qwt_plot_curve.cpp.

const QwtSymbol * QwtPlotCurve::symbol () const

Returns: Current symbol or NULL, when no symbol has been assigned

See also: setSymbol()

Definition: line 287 of file qwt_plot_curve.cpp.

bool QwtPlotCurve::testCurveAttribute (CurveAttribute attribute) const

Returns: true, if attribute is enabled

See also: setCurveAttribute()

Definition: line 839 of file qwt_plot_curve.cpp.

bool QwtPlotCurve::testLegendAttribute (LegendAttribute attribute) const

Returns: True, when attribute is enabled

See also: setLegendAttribute()

Definition: line 202 of file qwt_plot_curve.cpp.

bool QwtPlotCurve::testPaintAttribute (PaintAttribute attribute) const

Returns: True, when attribute is enabled

See also: setPaintAttribute()

Definition: line 172 of file qwt_plot_curve.cpp.


🧚 Author 🧚

Generated automatically by Doxygen for Qwt User's Guide from the source code.

✨ and that's the whole page, bestie β€” the footer vibes are Qwt User's Guide and QwtPlotCurve(3), so take that as your cute little sign-off. mwah πŸ’–

πŸ“¦ where this page comes from