Classes | Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
QwtPlotCurve Class Reference

A plot item, that represents a series of points. More...

#include <qwt_plot_curve.h>

Inheritance diagram for QwtPlotCurve:
Inheritance graph
[legend]

Classes

class  PrivateData
 

Public Types

enum  CurveAttribute { Inverted = 0x01, Fitted = 0x02 }
 
enum  CurveStyle {
  NoCurve = -1, Lines, Sticks, Steps,
  Dots, LinesAndDots, UserCurve = 100
}
 
enum  LegendAttribute { LegendNoAttribute = 0x00, LegendShowLine = 0x01, LegendShowSymbol = 0x02, LegendShowBrush = 0x04 }
 
enum  PaintAttribute {
  ClipPolygons = 0x01, FilterPoints = 0x02, MinimizeMemory = 0x04, ImageBuffer = 0x08,
  FilterPointsAggressive = 0x10
}
 
- Public Types inherited from QwtPlotItem
enum  ItemAttribute { Legend = 0x01, AutoScale = 0x02, Margins = 0x04 }
 Plot Item Attributes. More...
 
enum  ItemInterest { ScaleInterest = 0x01, LegendInterest = 0x02 }
 Plot Item Interests. More...
 
enum  RenderHint { RenderAntialiased = 0x1 }
 Render hints. More...
 
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. More...
 

Public Member Functions

virtual int adjacentPoint (Qt::Orientation orientation, qreal value) const
 
double baseline () const
 
const QBrush & brush () const
 
virtual int closestPoint (const QPointF &pos, double *dist=NULL) const
 
QwtCurveFittercurveFitter () const
 
virtual void drawSeries (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const QWT_OVERRIDE
 
qreal interpolatedValueAt (Qt::Orientation, double) const
 
LegendAttributes legendAttributes () const
 
virtual QwtGraphic legendIcon (int index, const QSizeF &) const QWT_OVERRIDE
 
double maxXValue () const
 boundingRect().right() More...
 
double maxYValue () const
 boundingRect().bottom() More...
 
double minXValue () const
 boundingRect().left() More...
 
double minYValue () const
 boundingRect().top() More...
 
const QPen & pen () const
 
 QwtPlotCurve (const QString &title=QString())
 
 QwtPlotCurve (const QwtText &title)
 
virtual int rtti () const QWT_OVERRIDE
 
void setBaseline (double)
 Set the value of the baseline. More...
 
void setBrush (const QBrush &)
 Assign a brush. More...
 
void setCurveAttribute (CurveAttribute, bool on=true)
 
void setCurveFitter (QwtCurveFitter *)
 
void setLegendAttribute (LegendAttribute, bool on=true)
 
void setLegendAttributes (LegendAttributes)
 
void setPaintAttribute (PaintAttribute, bool on=true)
 
void setPen (const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine)
 
void setPen (const QPen &)
 
void setRawSamples (const double *xData, const double *yData, int size)
 Initialize the data by pointing to memory blocks which are not managed by QwtPlotCurve. More...
 
void setRawSamples (const double *yData, int size)
 Initialize the data by pointing to a memory block which is not managed by QwtPlotCurve. More...
 
void setRawSamples (const float *xData, const float *yData, int size)
 Initialize the data by pointing to memory blocks which are not managed by QwtPlotCurve. More...
 
void setRawSamples (const float *yData, int size)
 Initialize the data by pointing to memory blocks which are not managed by QwtPlotCurve. More...
 
void setSamples (const double *xData, const double *yData, int size)
 
void setSamples (const double *yData, int size)
 
void setSamples (const float *xData, const float *yData, int size)
 
void setSamples (const float *yData, int size)
 
void setSamples (const QVector< double > &xData, const QVector< double > &yData)
 Initialize data with x- and y-arrays (explicitly shared) More...
 
void setSamples (const QVector< double > &yData)
 
void setSamples (const QVector< float > &xData, const QVector< float > &yData)
 Initialize data with x- and y-arrays (explicitly shared) More...
 
void setSamples (const QVector< float > &yData)
 
void setSamples (const QVector< QPointF > &)
 
void setSamples (QwtSeriesData< QPointF > *)
 
void setStyle (CurveStyle style)
 
void setSymbol (QwtSymbol *)
 Assign a symbol. More...
 
CurveStyle style () const
 
const QwtSymbolsymbol () const
 
bool testCurveAttribute (CurveAttribute) const
 
bool testLegendAttribute (LegendAttribute) const
 
bool testPaintAttribute (PaintAttribute) const
 
virtual ~QwtPlotCurve ()
 Destructor. More...
 
- Public Member Functions inherited from QwtPlotSeriesItem
virtual QRectF boundingRect () const QWT_OVERRIDE
 
virtual void draw (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const QWT_OVERRIDE
 Draw the complete series. More...
 
Qt::Orientation orientation () const
 
 QwtPlotSeriesItem (const QString &title=QString())
 
 QwtPlotSeriesItem (const QwtText &title)
 
void setOrientation (Qt::Orientation)
 
virtual void updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &) QWT_OVERRIDE
 Update the item to changes of the axes scale division. More...
 
virtual ~QwtPlotSeriesItem ()
 Destructor. More...
 
- Public Member Functions inherited from QwtPlotItem
void attach (QwtPlot *plot)
 Attach the item to a plot. More...
 
void detach ()
 This method detaches a QwtPlotItem from any QwtPlot it has been associated with. More...
 
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. More...
 
void hide ()
 Hide the item. More...
 
bool isVisible () const
 
virtual void itemChanged ()
 
virtual void legendChanged ()
 
virtual QList< QwtLegendDatalegendData () const
 Return all information, that is needed to represent the item on the legend. More...
 
QSize legendIconSize () const
 
QRectF paintRect (const QwtScaleMap &, const QwtScaleMap &) const
 Calculate the bounding paint rectangle of 2 maps. More...
 
QwtPlotplot () const
 Return attached plot. More...
 
 QwtPlotItem ()
 
 QwtPlotItem (const QString &title)
 
 QwtPlotItem (const QwtText &title)
 
uint renderThreadCount () const
 
QRectF scaleRect (const QwtScaleMap &, const QwtScaleMap &) const
 Calculate the bounding scale rectangle of 2 maps. More...
 
void setAxes (QwtAxisId xAxis, QwtAxisId yAxis)
 
void setItemAttribute (ItemAttribute, bool on=true)
 
void setItemInterest (ItemInterest, bool on=true)
 
void setLegendIconSize (const QSize &)
 
void setRenderHint (RenderHint, bool on=true)
 
void setRenderThreadCount (uint numThreads)
 
void setTitle (const QString &title)
 
void setTitle (const QwtText &title)
 
virtual void setVisible (bool)
 
void setXAxis (QwtAxisId)
 
void setYAxis (QwtAxisId)
 
void setZ (double z)
 Set the z value. More...
 
void show ()
 Show the item. More...
 
bool testItemAttribute (ItemAttribute) const
 
bool testItemInterest (ItemInterest) const
 
bool testRenderHint (RenderHint) const
 
const QwtTexttitle () const
 
virtual void updateLegend (const QwtPlotItem *, const QList< QwtLegendData > &)
 Update the item to changes of the legend info. More...
 
QwtAxisId xAxis () const
 Return xAxis. More...
 
QwtAxisId yAxis () const
 Return yAxis. More...
 
double z () const
 
virtual ~QwtPlotItem ()
 Destroy the QwtPlotItem. More...
 
- Public Member Functions inherited from QwtAbstractSeriesStore
virtual ~QwtAbstractSeriesStore ()
 Destructor. More...
 
- Public Member Functions inherited from QwtSeriesStore< QPointF >
QwtSeriesData< QPointF > * data ()
 
const QwtSeriesData< QPointF > * data () const
 
virtual QRectF dataRect () const QWT_OVERRIDE
 
virtual size_t dataSize () const QWT_OVERRIDE
 
 QwtSeriesStore ()
 Constructor The store contains no series. More...
 
QPointF sample (int index) const
 
void setData (QwtSeriesData< QPointF > *series)
 
virtual void setRectOfInterest (const QRectF &rect) QWT_OVERRIDE
 
QwtSeriesData< QPointF > * swapData (QwtSeriesData< QPointF > *series)
 
 ~QwtSeriesStore ()
 Destructor. More...
 

Protected Member Functions

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. More...
 
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. More...
 
virtual void drawDots (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
 
virtual void drawLines (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
 Draw lines. More...
 
virtual void drawSteps (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
 
virtual void drawSticks (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
 
virtual void drawSymbols (QPainter *, const QwtSymbol &, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
 
virtual void fillCurve (QPainter *, const QwtScaleMap &, const QwtScaleMap &, const QRectF &canvasRect, QPolygonF &) const
 
void init ()
 Initialize internal members. More...
 
- Protected Member Functions inherited from QwtPlotSeriesItem
virtual void dataChanged () QWT_OVERRIDE
 dataChanged() indicates, that the series has been changed. More...
 
- Protected Member Functions inherited from QwtPlotItem
QwtGraphic defaultIcon (const QBrush &, const QSizeF &) const
 Return a default icon from a brush. More...
 
- Protected Member Functions inherited from QwtAbstractSeriesStore
virtual QRectF dataRect () const =0
 
virtual size_t dataSize () const =0
 

Private Attributes

PrivateDatam_data
 

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 ( f.e. spline ) and symbols.

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().
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.
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 Enumeration Documentation

◆ CurveAttribute

Attribute for drawing the curve

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.

Definition at line 114 of file qwt_plot_curve.h.

◆ CurveStyle

Curve styles.

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.

LinesAndDots 
UserCurve 

Styles >= QwtPlotCurve::UserCurve are reserved for derived classes of QwtPlotCurve that overload drawCurve() with additional application specific curve types.

Definition at line 65 of file qwt_plot_curve.h.

◆ LegendAttribute

Attributes how to represent the curve on the legend

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 144 of file qwt_plot_curve.h.

◆ PaintAttribute

Attributes to modify the drawing algorithm. The default setting enables ClipPolygons | FilterPoints

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

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
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.

Definition at line 178 of file qwt_plot_curve.h.

Constructor & Destructor Documentation

◆ QwtPlotCurve() [1/2]

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

Constructor

Parameters
titleTitle of the curve

Definition at line 122 of file qwt_plot_curve.cpp.

◆ QwtPlotCurve() [2/2]

QwtPlotCurve::QwtPlotCurve ( const QwtText title)
explicit

Constructor

Parameters
titleTitle of the curve

Definition at line 112 of file qwt_plot_curve.cpp.

◆ ~QwtPlotCurve()

QwtPlotCurve::~QwtPlotCurve ( )
virtual

Destructor.

Definition at line 129 of file qwt_plot_curve.cpp.

Member Function Documentation

◆ adjacentPoint()

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.

Parameters
orientationQt::Horizontal corresponds to x, Qt::Vertical to y coordinates
valuex 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 1123 of file qwt_plot_curve.cpp.

◆ baseline()

double QwtPlotCurve::baseline ( ) const
Returns
Value of the baseline
See also
setBaseline()

Definition at line 1053 of file qwt_plot_curve.cpp.

◆ brush()

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 365 of file qwt_plot_curve.cpp.

◆ closePolyline()

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.

Parameters
painterPainter
xMapX map
yMapY map
polygonPolygon to be completed

Definition at line 947 of file qwt_plot_curve.cpp.

◆ closestPoint()

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

Find the closest curve point for a specific position

Parameters
posPosition, where to look for the closest curve point
distIf 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

Definition at line 1069 of file qwt_plot_curve.cpp.

◆ curveFitter()

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 890 of file qwt_plot_curve.cpp.

◆ drawCurve()

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

Draw the line part (without symbols) of a curve interval.

Parameters
painterPainter
stylecurve style, see QwtPlotCurve::CurveStyle
xMapx map
yMapy map
canvasRectContents rectangle of the canvas
fromindex of the first point to be painted
toindex of the last point to be painted
See also
draw(), drawDots(), drawLines(), drawSteps(), drawSticks()

Definition at line 431 of file qwt_plot_curve.cpp.

◆ drawDots()

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

Draw dots

Parameters
painterPainter
xMapx map
yMapy map
canvasRectContents rectangle of the canvas
fromindex of the first point to be painted
toindex of the last point to be painted
See also
draw(), drawCurve(), drawSticks(), drawLines(), drawSteps()

Definition at line 658 of file qwt_plot_curve.cpp.

◆ drawLines()

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

Draw lines.

If the CurveAttribute Fitted is enabled a QwtCurveFitter tries to interpolate/smooth the curve, before it is painted.

Parameters
painterPainter
xMapx map
yMapy map
canvasRectContents rectangle of the canvas
fromindex of the first point to be painted
toindex of the last point to be painted
See also
setCurveAttribute(), setCurveFitter(), draw(), drawLines(), drawDots(), drawSteps(), drawSticks()

Definition at line 494 of file qwt_plot_curve.cpp.

◆ drawSeries()

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

Draw an interval of the curve

Parameters
painterPainter
xMapMaps x-values into pixel coordinates.
yMapMaps y-values into pixel coordinates.
canvasRectContents rectangle of the canvas
fromIndex of the first point to be painted
toIndex 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 383 of file qwt_plot_curve.cpp.

◆ drawSteps()

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

Draw step function

The direction of the steps depends on Inverted attribute.

Parameters
painterPainter
xMapx map
yMapy map
canvasRectContents rectangle of the canvas
fromindex of the first point to be painted
toindex of the last point to be painted
See also
CurveAttribute, setCurveAttribute(), draw(), drawCurve(), drawDots(), drawLines(), drawSticks()

Definition at line 759 of file qwt_plot_curve.cpp.

◆ drawSticks()

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

Draw sticks

Parameters
painterPainter
xMapx map
yMapy map
canvasRectContents rectangle of the canvas
fromindex of the first point to be painted
toindex of the last point to be painted
See also
draw(), drawCurve(), drawDots(), drawLines(), drawSteps()

Definition at line 603 of file qwt_plot_curve.cpp.

◆ drawSymbols()

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

Draw symbols

Parameters
painterPainter
symbolCurve symbol
xMapx map
yMapy map
canvasRectContents rectangle of the canvas
fromIndex of the first point to be painted
toIndex of the last point to be painted
See also
setSymbol(), drawSeries(), drawCurve()

Definition at line 997 of file qwt_plot_curve.cpp.

◆ fillCurve()

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

Fill the area between the curve and the baseline with the curve brush

Parameters
painterPainter
xMapx map
yMapy map
canvasRectContents rectangle of the canvas
polygonPolygon - will be modified !
See also
setBrush(), setBaseline(), setStyle()

Definition at line 907 of file qwt_plot_curve.cpp.

◆ init()

void QwtPlotCurve::init ( )
protected

Initialize internal members.

Definition at line 135 of file qwt_plot_curve.cpp.

◆ interpolatedValueAt()

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

Calculate a fictive curve point by interpolating between the adjacent points. The curve points have to be monotonic in direction of the orientation.

Parameters
orientationFor Qt::Horizontal value is a x coordinate and a y coordinate is returned. For Qt::Vertical value is a x coordinate
valuex or y coordinate, depending on the orientation
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 being ordered in direction of the orientation.
See also
adjacentPoint()

Definition at line 1173 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 227 of file qwt_plot_curve.cpp.

◆ legendIcon()

QwtGraphic QwtPlotCurve::legendIcon ( int  index,
const QSizeF &  size 
) const
virtual
Returns
Icon representing the curve on the legend
Parameters
indexIndex of the legend entry ( ignored as there is only one )
sizeIcon size
See also
QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()

Reimplemented from QwtPlotItem.

Definition at line 1238 of file qwt_plot_curve.cpp.

◆ maxXValue()

double QwtPlotCurve::maxXValue ( ) const
inline

boundingRect().right()

Definition at line 360 of file qwt_plot_curve.h.

◆ maxYValue()

double QwtPlotCurve::maxYValue ( ) const
inline

boundingRect().bottom()

Definition at line 372 of file qwt_plot_curve.h.

◆ minXValue()

double QwtPlotCurve::minXValue ( ) const
inline

boundingRect().left()

Definition at line 354 of file qwt_plot_curve.h.

◆ minYValue()

double QwtPlotCurve::minYValue ( ) const
inline

boundingRect().top()

Definition at line 366 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 330 of file qwt_plot_curve.cpp.

◆ rtti()

int QwtPlotCurve::rtti ( ) const
virtual
Returns
QwtPlotItem::Rtti_PlotCurve

Reimplemented from QwtPlotItem.

Definition at line 147 of file qwt_plot_curve.cpp.

◆ setBaseline()

void QwtPlotCurve::setBaseline ( double  value)

Set the value of the baseline.

The baseline is needed for filling the curve with a brush or the Sticks drawing style.

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 is interpreted as a vertical line at x = baseline().

The default value is 0.0.

Parameters
valueValue of the baseline
See also
baseline(), setBrush(), setStyle(), QwtPlotAbstractSeriesItem::orientation()

Definition at line 1040 of file qwt_plot_curve.cpp.

◆ setBrush()

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).

Parameters
brushNew brush
See also
brush(), setBaseline(), baseline()

Definition at line 350 of file qwt_plot_curve.cpp.

◆ setCurveAttribute()

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

Specify an attribute for drawing the curve

Parameters
attributeCurve attribute
onOn/Off

/sa testCurveAttribute(), setCurveFitter()

Definition at line 837 of file qwt_plot_curve.cpp.

◆ setCurveFitter()

void QwtPlotCurve::setCurveFitter ( QwtCurveFitter curveFitter)

Assign a curve fitter

The curve fitter "smooths" the curve points, when the Fitted CurveAttribute is set. setCurveFitter(NULL) also disables curve fitting.

The curve fitter operates on the translated points ( = widget coordinates) to be functional for logarithmic scales. Obviously this is less performant for fitting algorithms, that reduce the number of points.

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.

Parameters
curveFitter()Curve fitter
See also
Fitted

Definition at line 876 of file qwt_plot_curve.cpp.

◆ setLegendAttribute()

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

Specify an attribute how to draw the legend icon

Parameters
attributeAttribute
onOn/Off /sa testLegendAttribute(). legendIcon()

Definition at line 183 of file qwt_plot_curve.cpp.

◆ setLegendAttributes()

void QwtPlotCurve::setLegendAttributes ( LegendAttributes  attributes)

Specify the attributes how to draw the legend icon

Parameters
attributesAttributes /sa setLegendAttribute(). legendIcon()

Definition at line 212 of file qwt_plot_curve.cpp.

◆ setPaintAttribute()

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

Specify an attribute how to draw the curve

Parameters
attributePaint attribute
onOn/Off
See also
testPaintAttribute()

Definition at line 159 of file qwt_plot_curve.cpp.

◆ setPen() [1/2]

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

Build and assign a pen

In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it non cosmetic ( see QPen::isCosmetic() ). This method has been introduced to hide this incompatibility.

Parameters
colorPen color
widthPen width
stylePen style
See also
pen(), brush()

Definition at line 304 of file qwt_plot_curve.cpp.

◆ setPen() [2/2]

void QwtPlotCurve::setPen ( const QPen &  pen)

Assign a pen

Parameters
penNew pen
See also
pen(), brush()

Definition at line 315 of file qwt_plot_curve.cpp.

◆ setRawSamples() [1/4]

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

Initialize 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.

Parameters
xDatapointer to x data
yDatapointer to y data
sizesize of x and y
See also
QwtCPointerData

Definition at line 1346 of file qwt_plot_curve.cpp.

◆ setRawSamples() [2/4]

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

Initialize the data by pointing to a memory block which is not managed by QwtPlotCurve.

The memory contains the y coordinates, while the index is interpreted as x coordinate.

setRawSamples() is provided for efficiency. It is important to keep the pointers during the lifetime of the underlying QwtCPointerValueData class.

Parameters
yDatapointer to y data
sizesize of x and y
See also
QwtCPointerData

Definition at line 1388 of file qwt_plot_curve.cpp.

◆ setRawSamples() [3/4]

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

Initialize 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.

Parameters
xDatapointer to x data
yDatapointer to y data
sizesize of x and y
See also
QwtCPointerData

Definition at line 1366 of file qwt_plot_curve.cpp.

◆ setRawSamples() [4/4]

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

Initialize the data by pointing to memory blocks which are not managed by QwtPlotCurve.

The memory contains the y coordinates, while the index is interpreted as x coordinate.

setRawSamples() is provided for efficiency. It is important to keep the pointers during the lifetime of the underlying QwtCPointerValueData class.

Parameters
yDatapointer to y data
sizesize of x and y
See also
QwtCPointerData

Definition at line 1409 of file qwt_plot_curve.cpp.

◆ setSamples() [1/10]

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.

Parameters
xDatapointer to x values
yDatapointer to y values
sizesize of xData and yData
See also
QwtPointArrayData

Definition at line 1425 of file qwt_plot_curve.cpp.

◆ setSamples() [2/10]

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.

Parameters
yDatay data
sizesize of yData
See also
QwtValuePointData

Definition at line 1487 of file qwt_plot_curve.cpp.

◆ setSamples() [3/10]

void QwtPlotCurve::setSamples ( const float *  xData,
const float *  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.

Parameters
xDatapointer to x values
yDatapointer to y values
sizesize of xData and yData
See also
QwtPointArrayData

Definition at line 1442 of file qwt_plot_curve.cpp.

◆ setSamples() [4/10]

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.

Parameters
yDatay data
sizesize of yData
See also
QwtValuePointData

Definition at line 1503 of file qwt_plot_curve.cpp.

◆ setSamples() [5/10]

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

Initialize data with x- and y-arrays (explicitly shared)

Parameters
xDatax data
yDatay data
See also
QwtPointArrayData

Definition at line 1456 of file qwt_plot_curve.cpp.

◆ setSamples() [6/10]

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.

Parameters
yDatay data
See also
QwtValuePointData

Definition at line 1518 of file qwt_plot_curve.cpp.

◆ setSamples() [7/10]

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

Initialize data with x- and y-arrays (explicitly shared)

Parameters
xDatax data
yDatay data
See also
QwtPointArrayData

Definition at line 1470 of file qwt_plot_curve.cpp.

◆ setSamples() [8/10]

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.

Parameters
yDatay data
See also
QwtValuePointData

Definition at line 1533 of file qwt_plot_curve.cpp.

◆ setSamples() [9/10]

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

Initialize data with an array of points.

Parameters
samplesVector of points
Note
QVector is implicitly shared
QPolygonF is derived from QVector<QPointF>

Definition at line 1327 of file qwt_plot_curve.cpp.

◆ setSamples() [10/10]

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.

Parameters
dataData
Warning
The item takes ownership of the data object, deleting it when its not used anymore.

Definition at line 1315 of file qwt_plot_curve.cpp.

◆ setStyle()

void QwtPlotCurve::setStyle ( CurveStyle  style)

Set the curve's drawing style

Parameters
styleCurve style
See also
style()

Definition at line 238 of file qwt_plot_curve.cpp.

◆ setSymbol()

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.

Parameters
symbolSymbol
See also
symbol()

Definition at line 268 of file qwt_plot_curve.cpp.

◆ style()

QwtPlotCurve::CurveStyle QwtPlotCurve::style ( ) const
Returns
Style of the curve
See also
setStyle()

Definition at line 253 of file qwt_plot_curve.cpp.

◆ symbol()

const QwtSymbol * QwtPlotCurve::symbol ( ) const
Returns
Current symbol or NULL, when no symbol has been assigned
See also
setSymbol()

Definition at line 286 of file qwt_plot_curve.cpp.

◆ testCurveAttribute()

bool QwtPlotCurve::testCurveAttribute ( CurveAttribute  attribute) const
Returns
true, if attribute is enabled
See also
setCurveAttribute()

Definition at line 854 of file qwt_plot_curve.cpp.

◆ testLegendAttribute()

bool QwtPlotCurve::testLegendAttribute ( LegendAttribute  attribute) const
Returns
True, when attribute is enabled
See also
setLegendAttribute()

Definition at line 201 of file qwt_plot_curve.cpp.

◆ testPaintAttribute()

bool QwtPlotCurve::testPaintAttribute ( PaintAttribute  attribute) const
Returns
True, when attribute is enabled
See also
setPaintAttribute()

Definition at line 171 of file qwt_plot_curve.cpp.

Member Data Documentation

◆ m_data

PrivateData* QwtPlotCurve::m_data
private

Definition at line 349 of file qwt_plot_curve.h.


The documentation for this class was generated from the following files:


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:50