QwtSyntheticPointData(3)
๐ QwtSyntheticPointData(3) โ Library Functions Manual ๐
okay bestie, welcome to the Library Functions Manual page for QwtSyntheticPointData(3) ๐
this is synthetic point data and itโs lowkey iconic.
๐ NAME ๐
QwtSyntheticPointData โ synthetic point data, periodt โจ
๐ SYNOPSIS ๐
#include <qwt_point_data.h>
Inherits QwtSeriesData< QPointF >.
๐ซถ Public Member Functions
QwtSyntheticPointData (size_t size, const QwtInterval &=QwtInterval())โ constructor vibes.void setSize (size_t size)โ change the number of points.virtual size_t size () const overrideโ get the number of points.void setInterval (const QwtInterval &)โ set the bounding interval.QwtInterval interval () constโ get the bounding interval.virtual QRectF boundingRect () const overrideโ calculate the bounding rectangle.virtual QPointF sample (size_t index) const overrideโ calculate the point from an index.virtual double y (double x) const =0โ calculate a y value for an x value.virtual double x (uint index) constโ calculate an x-value from an index.virtual void setRectOfInterest (const QRectF &) overrideโ set the โrectangle of interestโ.QRectF rectOfInterest () constโ get the โrectangle of interestโ.
๐ฆ Public Member Functions inherited from QwtSeriesData< QPointF >
QwtSeriesData ()โ Constructor.virtual ~QwtSeriesData ()โ Destructor.QPointF firstSample () constโ first sample, bestie.QPointF lastSample () constโ last sample, bestie.
๐ธ Additional Inherited Members
Protected Attributes inherited from QwtSeriesData< QPointF >
QRectF cachedBoundingRectโ can be used to cache a calculated bounding rectangle. slay for performance ๐
โจ Detailed Description โจ
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 โ literally the main character energy of plot data ๐ซถ
๐ง 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. okay so hereโs what you pass in:
- size โ Number of points.
- interval โ Bounding interval for the points.
See also setInterval(), setSize().
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 literally 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) โ no cap, thatโs the move.
Returns: Bounding rectangle.
Reimplemented from QwtSeriesData< QPointF >.
Definition at line 105 of file qwt_point_data.cpp.
QwtInterval QwtSyntheticPointData::interval () const
Returns: Bounding interval.
See also setInterval(), size().
Definition at line 62 of file qwt_point_data.cpp.
QRectF QwtSyntheticPointData::rectOfInterest () const
Returns: โrectangle of interestโ.
See also setRectOfInterest().
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.
- index โ Index.
Returns: QPointF(x(index), y(x(index)));
โ ๏ธ Warning: For invalid indices (index < 0 || index >= size())(0, 0)is returned. so bestie, vibe-check your index first ๐ญ
Implements QwtSeriesData< QPointF >.
Definition at line 125 of file qwt_point_data.cpp.
void QwtSyntheticPointData::setInterval (const QwtInterval & interval)
Set the bounding interval.
- interval โ Interval.
See also interval(), setSize().
Definition at line 53 of file qwt_point_data.cpp.
void QwtSyntheticPointData::setRectOfInterest (const QRectF & rect) [override], [virtual]
Set the โrectangle of interestโ โ yes, the original doc says โSet a theโ, and we keep the iconique typo energy ๐ญ๐
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().
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.
- size โ Number of points.
See also size(), setInterval().
Definition at line 33 of file qwt_point_data.cpp.
size_t QwtSyntheticPointData::size () const [override], [virtual]
Returns: Number of points.
See also setSize(), interval().
Implements QwtSeriesData< QPointF >.
Definition at line 42 of file qwt_point_data.cpp.
double QwtSyntheticPointData::x (uint index) const [virtual]
Calculate an 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โ.
- index โ Index of the requested point.
Returns: Calculated x coordinate.
See also interval(), rectOfInterest(), y().
Definition at line 148 of file qwt_point_data.cpp.
virtual double QwtSyntheticPointData::y (double x) const [pure virtual]
Calculate a y value for an x value.
- x โ x value.
Returns: Corresponding y value.
๐ AUTHOR ๐
Generated automatically by Doxygen for Qwt User's Guide from the source code.
mwah ๐ source/version sign-off: this page is from the Qwt User's Guide, page QwtSyntheticPointData(3), and the original footer has no date listed, so Iโm not inventing one ๐ bye bestie, go make those synthetic points look iconic โจ
๐ฆ 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