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 > CurveAttributestypedef QFlags< LegendAttribute > LegendAttributestypedef 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 > ItemAttributestypedef QFlags< ItemInterest > ItemIntereststypedef QFlags< RenderHint > RenderHints
π¦ Public Member Functions π¦
QwtPlotCurve (const QString &title=QString())β constructor, title optional.QwtPlotCurve (const QwtText &title)β constructor with aQwtTexttitle.virtual ~QwtPlotCurve ()β Destructor.virtual int rtti () const overrideβ runtime type info, override style.void setPaintAttribute (PaintAttribute, bool on=true)β set a paint attribute, defaulton=true.bool testPaintAttribute (PaintAttribute) constβ check a paint attribute.void setLegendAttribute (LegendAttribute, bool on=true)β set a legend attribute, defaulton=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 byQwtPlotCurve.void setRawSamples (const float *xData, const float *yData, int size)β Initialize the data by pointing to memory blocks which are not managed byQwtPlotCurve.void setRawSamples (const double *yData, int size)β Initialize the data by pointing to a memory block which is not managed byQwtPlotCurve.void setRawSamples (const float *yData, int size)β Initialize the data by pointing to memory blocks which are not managed byQwtPlotCurve.void setSamples (const double *xData, const double *yData, int size)β setsizesamples fromxDataandyData.void setSamples (const float *xData, const float *yData, int size)β setsizesamples fromxDataandyData, float version.void setSamples (const double *yData, int size)β setsizesamples from a y-only double array.void setSamples (const float *yData, int size)β setsizesamples 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 aQwtSeriesData< QPointF >pointer.virtual int closestPoint (const QPointF &pos, double *dist=NULL) constβ closest point, optionaldistpointer defaults toNULL.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, defaulton=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 to0.0, style defaults toQt::SolidLine.void setPen (const QPen &)β pen from aQPen.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 aQwtTexttitle.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 aQwtTexttitle.virtual ~QwtPlotItem ()β Destroy theQwtPlotItem.void attach (QwtPlot *plot)β Attach the item to a plot.void detach ()β This method detaches aQwtPlotItemfrom anyQwtPlotit 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 fromQwtText.const QwtText & title () constβ get the title.void setItemAttribute (ItemAttribute, bool on=true)β set item attribute, defaulton=true.bool testItemAttribute (ItemAttribute) constβ check item attribute.void setItemInterest (ItemInterest, bool on=true)β set item interest, defaulton=true.bool testItemInterest (ItemInterest) constβ check item interest.void setRenderHint (RenderHint, bool on=true)β set render hint, defaulton=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β ForQwtPlotCurve::Stepsonly. Draws a step function from the right to the left.Fittedβ Only in combination withQwtPlotCurve::Lines. AQwtCurveFittertries to interpolate/smooth the curve, before it is painted.
Note: Curve fitting requires temporary memory for calculating coefficients and additional points. If painting inQwtPlotCurve::Fittedmode is slow it might be better to fit the points, before they are passed toQwtPlotCurve. 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 usingsetCurveFitter().Sticksβ Draw vertical or horizontal sticks ( depending on theorientation()) from a baseline which is defined bysetBaseline().Stepsβ Connect the points with a step function. The step function is drawn from the left to the right or vice versa, depending on theQwtPlotCurve::Invertedattribute.Dotsβ Draw dots at the locations of the data points. Note: This is different from a dotted line (seesetPen()), and faster as a curve inQwtPlotCurve::NoStylestyle and a symbol painting a point.UserCurveβ Styles >=QwtPlotCurve::UserCurveare reserved for derived classes ofQwtPlotCurvethat overloaddrawCurve()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βQwtPlotCurvetries to find a color representing the curve and paints a rectangle with it.LegendShowLineβ If thestyle()is notQwtPlotCurve::NoCurvea line is painted with the curvepen().LegendShowSymbolβ If the curve has a valid symbol it is painted.LegendShowBrushβ If the curve has a brush a rectangle filled with the curvebrush()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 forDotsstyle, when having a huge amount of points. With a reasonable number of pointsQPainter::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 forQwtPlotCurve::Linesonly. 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 theQwtPainter::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::Horizontalcorresponds to x,Qt::Verticalto y coordinatesvalueβ 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β PainterxMapβ X mapyMapβ Y mappolygonβ 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 pointdistβ Ifdist!=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β Painterstyleβ curve style, seeQwtPlotCurve::CurveStylexMapβ x mapyMapβ y mapcanvasRectβ Contents rectangle of the canvasfromβ index of the first point to be paintedtoβ 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β PainterxMapβ x mapyMapβ y mapcanvasRectβ Contents rectangle of the canvasfromβ index of the first point to be paintedtoβ 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 < 0the 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,valueis a x coordinate and a y coordinate is returned. ForQt::Vertical,valueis 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 datasizeβ 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 datayDataβ pointer to y datasizeβ 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 datasizeβ 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 valuesyDataβ pointer to y valuessizeβ 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 datasizeβ 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 valuesyDataβ pointer to y valuessizeβ 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 datasizeβ 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 datayDataβ 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 datayDataβ 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:
QVectoris implicitly sharedQPolygonFis derived fromQVector<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
- alpine 3.24: qwt-doc 6.3.0-r0 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms