- bookworm 6.1.4-2
- testing 6.1.4-2
- unstable 6.1.4-2
- experimental 6.2.0-1
QwtSyntheticPointData(3) | Qwt User's Guide | QwtSyntheticPointData(3) |
NAME¶
QwtSyntheticPointData - Synthetic point data.
SYNOPSIS¶
#include <qwt_point_data.h>
Inherits QwtPointSeriesData.
Public Member Functions¶
QwtSyntheticPointData (size_t size, const
QwtInterval &=QwtInterval())
void setSize (size_t size)
virtual size_t size () const override
void setInterval (const QwtInterval &)
QwtInterval interval () const
virtual QRectF boundingRect () const override
Calculate the bounding rectangle. virtual QPointF sample (size_t index)
const override
virtual double y (double x) const =0
virtual double x (uint index) const
virtual void setRectOfInterest (const QRectF &) override
QRectF rectOfInterest () const
Additional Inherited Members¶
Detailed Description¶
Synthetic point data.
QwtSyntheticPointData provides a fixed number of points for an interval. The points are calculated in equidistant steps in x-direction.
If the interval is invalid, the points are calculated for the 'rectangle of interest', what normally is the displayed area on the plot canvas. In this mode you get different levels of detail, when zooming in/out.
Example
The following example shows how to implement a sinus curve.
#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( QwtAxis::XBottom, 0.0, 10.0 );
plot.setAxisScale( QwtAxis::YLeft, -1.0, 1.0 );
QwtPlotCurve *curve = new QwtPlotCurve( "y = sin(x)" );
curve->setData( new SinusData() );
curve->attach( &plot );
plot.show();
return a.exec();
}
Definition at line 157 of file qwt_point_data.h.
Constructor & Destructor Documentation¶
QwtSyntheticPointData::QwtSyntheticPointData (size_t size, const QwtInterval & interval = QwtInterval())¶
Constructor
Parameters
interval Bounding interval for the points
See also
Definition at line 20 of file qwt_point_data.cpp.
Member Function Documentation¶
QRectF QwtSyntheticPointData::boundingRect () const [override], [virtual]¶
Calculate the bounding rectangle. 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
Reimplemented from QwtPointSeriesData.
Definition at line 105 of file qwt_point_data.cpp.
QwtInterval QwtSyntheticPointData::interval () const¶
Returns
See also
Definition at line 62 of file qwt_point_data.cpp.
QRectF QwtSyntheticPointData::rectOfInterest () const¶
Returns
See also
Definition at line 89 of file qwt_point_data.cpp.
QPointF QwtSyntheticPointData::sample (size_t index) const [override], [virtual]¶
Calculate the point from an index
Parameters
Returns
Warning
Reimplemented from QwtArraySeriesData< QPointF >.
Definition at line 125 of file qwt_point_data.cpp.
void QwtSyntheticPointData::setInterval (const QwtInterval & interval)¶
Set the bounding interval
Parameters
See also
Definition at line 53 of file qwt_point_data.cpp.
void QwtSyntheticPointData::setRectOfInterest (const QRectF & rect) [override], [virtual]¶
Set a the 'rectangle 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
Reimplemented from QwtSeriesData< QPointF >.
Definition at line 78 of file qwt_point_data.cpp.
void QwtSyntheticPointData::setSize (size_t size)¶
Change the number of points
Parameters
See also
Definition at line 33 of file qwt_point_data.cpp.
size_t QwtSyntheticPointData::size () const [override], [virtual]¶
Returns
See also
Reimplemented from QwtArraySeriesData< QPointF >.
Definition at line 42 of file qwt_point_data.cpp.
double QwtSyntheticPointData::x (uint index) const [virtual]¶
Calculate a x-value from an index
x values are calculated by dividing an interval into equidistant steps. If !interval().isValid() the interval is calculated from the 'rectangle of interest'.
Parameters
Returns
See also
Definition at line 148 of file qwt_point_data.cpp.
virtual double QwtSyntheticPointData::y (double x) const [pure virtual]¶
Calculate a y value for a x value
Parameters
Returns
Author¶
Generated automatically by Doxygen for Qwt User's Guide from the source code.
Sun Jul 18 2021 | Version 6.2.0 |