Logo Search packages:      
Sourcecode: pcp-gui version File versions

QwtPlotCurve Class Reference

#include <qwt_plot_curve.h>

Inheritance diagram for QwtPlotCurve:

QwtPlotItem

List of all members.


Detailed Description

A class which draws curves.

This class can be used to display data as a curve in the x-y plane. It supports different display styles, spline interpolation and symbols.

Usage
A. Assign curve properties
When a curve is created, it is configured to draw black solid lines with QwtPlotCurve::Lines and no symbols. You can change this by calling setPen(), setStyle() and setSymbol().
B. Assign or change data.
Data can be set in two ways:
  • setData() is overloaded to initialize the x and y data by copying from different data structures with different kind of copy semantics.
  • setRawData() only stores the pointers and size information and is provided for backwards compatibility. This function is less safe (you must not delete the data while they are attached), but has been more efficient, and has been more convenient for dynamically changing data. Use of setData() in combination with a problem-specific subclass of QwtData is always preferrable.
C. Draw
draw() maps the data into pixel coordinates and paints them.
Example:
see examples/curvdemo
See also:
QwtData, QwtSymbol, QwtScaleMap

Definition at line 56 of file qwt_plot_curve.h.


Public Types

enum  CurveAttribute { Inverted = 1, Fitted = 2 }
enum  CurveStyle {
  NoCurve, Lines, Sticks, Steps,
  Dots, UserCurve = 100
}
enum  CurveType { Yfx, Xfy }
enum  ItemAttribute { Legend = 1, AutoScale = 2 }
enum  PaintAttribute { PaintFiltered = 1, ClipPolygons = 2 }
enum  RttiValues {
  Rtti_PlotItem = 0, Rtti_PlotGrid, Rtti_PlotMarker, Rtti_PlotCurve,
  Rtti_PlotHistogram, Rtti_PlotSpectrogram, Rtti_PlotSVG, Rtti_PlotUserItem = 1000
}

Public Member Functions

void attach (QwtPlot *plot)
double baseline () const
virtual QwtDoubleRect boundingRect () const
const QBrush & brush () const
 Return the brush used to fill the area between lines and the baseline.
int closestPoint (const QPoint &pos, double *dist=NULL) const
QwtCurveFittercurveFitter () const
CurveType curveType () const
const QwtDatadata () const
QwtDatadata ()
int dataSize () const
void detach ()
void draw (int from, int to) const
 Draw a set of points of a curve.
virtual void draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
 Draw an interval of the curve.
virtual void draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &) const
 Draw the complete curve.
void hide ()
QwtDoubleRect invTransform (const QwtScaleMap &, const QwtScaleMap &, const QRect &) const
bool isVisible () const
virtual void itemChanged ()
virtual QWidget * legendItem () const
 Allocate the widget that represents the item on the legend.
const QPen & legendPen () const
 Return the pen used to draw the legend lines.
double maxXValue () const
 boundingRect().right()
double maxYValue () const
 boundingRect().bottom()
double minXValue () const
 boundingRect().left()
double minYValue () const
 boundingRect().top()
QRect paintRect (const QwtScaleMap &, const QwtScaleMap &) const
 Calculate the bounding paint rect of 2 maps.
const QPen & pen () const
 Return the pen used to draw the lines.
QwtPlotplot () const
 Return attached plot.
 QwtPlotCurve (const QString &title)
 Ctor.
 QwtPlotCurve (const QwtText &title)
 Ctor.
 QwtPlotCurve ()
 Ctor.
virtual int rtti () const
QwtDoubleRect scaleRect (const QwtScaleMap &, const QwtScaleMap &) const
 Calculate the bounding scale rect of 2 maps.
void setAxis (int xAxis, int yAxis)
void setBaseline (double ref)
 Set the value of the baseline.
void setBrush (const QBrush &)
 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).
void setCurveAttribute (CurveAttribute, bool on=true)
 Specify an attribute for drawing the curve.
void setCurveFitter (QwtCurveFitter *)
void setCurveType (CurveType)
void setData (const QwtData &data)
void setData (const QwtArray< QwtDoublePoint > &data)
void setData (const QwtArray< double > &xData, const QwtArray< double > &yData)
 Initialize data with x- and y-arrays (explicitly shared).
void setData (const double *xData, const double *yData, int size)
void setItemAttribute (ItemAttribute, bool on=true)
void setLegendPen (const QPen &)
 Assign a pen for the legend.
void setPaintAttribute (PaintAttribute, bool on=true)
 Specify an attribute how to draw the curve.
void setPen (const QPen &)
 Assign a pen.
void setRawData (const double *x, const double *y, int size)
 Initialize the data by pointing to memory blocks which are not managed by QwtPlotCurve.
void setStyle (CurveStyle style)
 Set the curve's drawing style.
void setSymbol (const QwtSymbol &s)
 Assign a symbol.
void setTitle (const QwtText &title)
void setTitle (const QString &title)
virtual void setVisible (bool)
void setXAxis (int axis)
void setYAxis (int axis)
void setZ (double z)
 Set the z value.
void show ()
CurveStyle style () const
 Return the current style.
const QwtSymbolsymbol () const
 Return the current symbol.
bool testCurveAttribute (CurveAttribute) const
bool testItemAttribute (ItemAttribute) const
bool testPaintAttribute (PaintAttribute) const
 Return the current paint attributes.
const QwtTexttitle () const
QRect transform (const QwtScaleMap &, const QwtScaleMap &, const QwtDoubleRect &) const
virtual void updateLegend (QwtLegend *) const
 Update the widget that represents the item on the legend.
virtual void updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &)
 Update the item to changes of the axes scale division.
double x (int i) const
int xAxis () const
 Return xAxis.
double y (int i) const
int yAxis () const
 Return yAxis.
double z () const
virtual ~QwtPlotCurve ()
 Dtor.

Protected Member Functions

void closePolyline (const QwtScaleMap &, const QwtScaleMap &, QwtPolygon &) const
 Complete a polygon to be a closed polygon including the area between the original polygon and the baseline.
virtual void drawCurve (QPainter *p, int style, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
 Draw the line part (without symbols) of a curve interval.
void drawDots (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
void drawLines (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
 Draw lines.
void drawSteps (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
void drawSticks (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
virtual void drawSymbols (QPainter *p, const QwtSymbol &, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
 Draw symbols.
void fillCurve (QPainter *, const QwtScaleMap &, const QwtScaleMap &, QwtPolygon &) const
void init ()
 Initialize data members.

Private Attributes

PrivateData * d_data
QwtDatad_xy

Classes

class  PrivateData

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

Generated by  Doxygen 1.6.0   Back to index