QwtSyntheticPointData(3) | Qwt User's Guide | QwtSyntheticPointData(3) |
NAME¶
QwtSyntheticPointData - Synthetic point data.SYNOPSIS¶
#include <qwt_series_data.h> Inherits QwtSeriesData< QPointF >.Public Member Functions¶
QwtSyntheticPointData (size_t size, const QwtInterval &=QwtInterval())
Detailed Description¶
Synthetic point data.#include <cmath> #include <qwt_series_data.h> #include <qwt_plot_curve.h> #include <qwt_plot.h> #include <qapplication.h> class SinusData: public QwtSyntheticPointData { public: SinusData(): QwtSyntheticPointData(100) { } virtual double y(double x) const { return qSin(x); } }; int main(int argc, char **argv) { QApplication a(argc, argv); QwtPlot plot; plot.setAxisScale(QwtPlot::xBottom, 0.0, 10.0); plot.setAxisScale(QwtPlot::yLeft, -1.0, 1.0); QwtPlotCurve *curve = new QwtPlotCurve("y = sin(x)"); curve->setData(SinusData()); curve->attach(&plot); plot.show(); return a.exec(); } .fi
Constructor & Destructor Documentation¶
QwtSyntheticPointData::QwtSyntheticPointData (size_tsize, const QwtInterval &interval = QwtInterval()) Constructor¶
Parameters:size Number of points
interval Bounding interval for the points
See also:
setInterval(), setSize()
Member Function Documentation¶
QRectF QwtSyntheticPointData::boundingRect () const [virtual]¶
Calculate the bounding rect. This implementation iterates over all points, what could often be implemented much faster using the characteristics of the series. When there are many points it is recommended to overload and reimplement this method using the characteristics of the series ( if possible ). Returns:Bounding rectangle
QwtInterval QwtSyntheticPointData::interval () const Returns:¶
Bounding interval
See also:
setInterval(), size()
QRectF QwtSyntheticPointData::rectOfInterest () const Returns:¶
See also:setRectOfInterest()
QPointF QwtSyntheticPointData::sample (size_tindex) const [virtual] Calculate the point from an index¶
Parameters:index Index
Returns:
QPointF(x(index), y(x(index)));
Warning:
For invalid indices ( index < 0 || index
>= size() ) (0, 0) is returned.
void QwtSyntheticPointData::setInterval (const QwtInterval &interval) Set the bounding interval¶
Parameters:interval Interval
See also:
interval(), setSize()
void QwtSyntheticPointData::setRectOfInterest (const QRectF &rect) [virtual] Set a the 'rect of interest'¶
QwtPlotSeriesItem defines the current area of the plot canvas as 'rect of interest' ( QwtPlotSeriesItem::updateScaleDiv() ). If interval().isValid() == false the x values are calculated in the interval rect.left() -> rect.right(). See also:rectOfInterest()
void QwtSyntheticPointData::setSize (size_tsize) Change the number of points¶
Parameters:size Number of points
See also:
size(), setInterval()
size_t QwtSyntheticPointData::size () const [virtual] Returns:¶
Number of points
See also:
setSize(), interval()
double QwtSyntheticPointData::x (uintindex) const [virtual] Calculate a x-value from an index¶
x values are calculated by deviding an interval into equidistant steps. If !interval().isValid() the interval is calculated from the 'rect of interest'. See also:interval(), rectOfInterest(),
y()
virtual double QwtSyntheticPointData::y (doublex) const [pure virtual] Calculate a y value for a x value¶
Parameters:x x value
Returns:
Corresponding y value
Author¶
Generated automatically by Doxygen for Qwt User's Guide from the source code.Fri Apr 15 2011 | Version 6.0.0 |