QWTSERIESDATA(3)

🌸 QwtSeriesData< T > πŸ’…

ok so this is the QwtSeriesData< T > page from the Library Functions Manual, and bestie, it's a template class and it's lowkey the blueprint for how Qwt gets at your data. Let's get into it. ✨


✨ NAME ✨

QwtSeriesData< T > β€” the abstract interface for iterating over samples. that's it, that's the whole assignment. πŸŽ€


✨ SYNOPSIS ✨

#include <qwt_series_data.h>

Inherited by QwtArraySeriesData< T >. (so that one's already in the family, iykyk 🫢)

πŸ’– Public Member Functions

  • QwtSeriesData () β€” Constructor.
  • virtual ~QwtSeriesData () β€” Destructor.
  • virtual size_t size () const =0 β€” pure virtual, you have to implement it, no skipping.
  • virtual T sample (size_t i) const =0 β€” also pure virtual, also mandatory, slay.
  • T firstSample () const
  • T lastSample () const
  • virtual QRectF boundingRect () const
  • virtual void setRectOfInterest (const QRectF &rect)

πŸ¦‹ Protected Attributes

  • QRectF cachedBoundingRect β€” Can be used to cache a calculated bounding rectangle.

πŸ’œ Detailed Description πŸ’œ

template<typename T>
class QwtSeriesData< T >

"Abstract interface for iterating over samples." β€” that's the official vibe check. πŸ‘‘

Qwt ships several implementations of the QwtSeriesData API already, but listen: in situations where data of an application specific format needs to be displayed without having to copy it, it is recommended to implement an individual data access. no copying, no extra work, just plug it in directly. periodt. πŸ’…

A subclass of QwtSeriesData<QPointF> must implement these three, no exceptions:

  • size() β€” Should return number of data points.
  • sample() β€” Should return values x and y values of the sample at specific position as QPointF object.
  • boundingRect() β€” Should return the bounding rectangle of the data series. It is used for autoscaling and might help certain algorithms for displaying the data. You can use qwtBoundingRect() for an implementation but often it is possible to implement a more efficient algorithm depending on the characteristics of the series. The member cachedBoundingRect is intended for caching the calculated rectangle.
Definition at line 49 of file qwt_series_data.h. πŸ“

πŸŽ€ Constructor & Destructor Documentation πŸŽ€

template<typename T> QwtSeriesData< T >::QwtSeriesData ()

Constructor. that's literally the whole note, we love a low-effort king. 😌

Definition at line 130 of file qwt_series_data.h.

template<typename T> QwtSeriesData< T >::~QwtSeriesData () [virtual]

Destructor. virtual, so it cleans up after itself properly, we stan. 🧹

Definition at line 136 of file qwt_series_data.h.

πŸ”₯ Member Function Documentation πŸ”₯

template<typename T> virtual QRectF QwtSeriesData< T >::boundingRect () const [inline], [virtual]

Calculate the bounding rect of all samples. πŸ“

The bounding rect is necessary for autoscaling and can be used for a couple of painting optimizations.

qwtBoundingRect(...) offers slow implementations iterating over the samples. For large sets it is recommended to implement something faster. (ngl this is the "do your homework but make it efficient" of the whole page.)

Returns β€” Bounding rectangle

Reimplemented in QwtSyntheticPointData.

Definition at line 100 of file qwt_series_data.h.

template<typename T> T QwtSeriesData< T >::firstSample () const [inline]

Returns the first sample in the list.

Warning ⚠️ β€” This function assumes that the list isn't empty. so like… check first, bestie, or it's giving undefined behaviour energy. 😭
Definition at line 80 of file qwt_series_data.h.

template<typename T> T QwtSeriesData< T >::lastSample () const [inline]

Returns the first sample in the list.

πŸ’€ okay yes, the docs literally say "first" here too, that's a typo in the original and I'm not about to gaslight you about it. I'm keeping it exactly as documented. But the function is named lastSample so… do with that what you will, fr fr.
Warning ⚠️ β€” This function assumes that the list isn't empty. same warning, same danger, empty list = bad time.
Definition at line 86 of file qwt_series_data.h.

template<typename T> virtual T QwtSeriesData< T >::sample (size_t i) const [pure virtual]

Return a sample. πŸ“

Parameters β€” i Index

Returns β€” Sample at position i

Implemented in QwtArraySeriesData< T >, QwtArraySeriesData< QPointF >, QwtArraySeriesData< QwtIntervalSample >, QwtArraySeriesData< QwtOHLCSample >, QwtArraySeriesData< QwtPoint3D >, QwtArraySeriesData< QwtSetSample >, QwtArraySeriesData< QwtVectorFieldSample >, QwtCPointerData< T >, QwtCPointerValueData< T >, QwtPointArrayData< T >, QwtSyntheticPointData, and QwtValuePointData< T >. that's the whole roster, iconic lineup honestly. πŸ‘‘


template<typename T> void QwtSeriesData< T >::setRectOfInterest (const QRectF & rect) [virtual]

Set a the "rect of interest". (yes the stutter is canon, I don't make the rules πŸ’€)

QwtPlotSeriesItem defines the current area of the plot canvas as "rectangle of interest" ( QwtPlotSeriesItem::updateScaleDiv() ). It can be used to implement different levels of details.

The default implementation does nothing. so if you don't override it, it's just out here vibing and doing absolutely zero. ✨

Parameters β€” rect Rectangle of interest

Reimplemented in QwtSyntheticPointData.

Definition at line 141 of file qwt_series_data.h.

template<typename T> virtual size_t QwtSeriesData< T >::size () const [pure virtual]

Returns β€” Number of samples. that's it, that's the whole function, and yet you must write it yourself bestie. 🫢

Implemented in QwtArraySeriesData< T >, QwtArraySeriesData< QPointF >, QwtArraySeriesData< QwtIntervalSample >, QwtArraySeriesData< QwtOHLCSample >, QwtArraySeriesData< QwtPoint3D >, QwtArraySeriesData< QwtSetSample >, QwtArraySeriesData< QwtVectorFieldSample >, QwtCPointerData< T >, QwtCPointerValueData< T >, QwtPointArrayData< T >, QwtSyntheticPointData, and QwtValuePointData< T >. same squad as sample(), they really do everything together. πŸ’–


🌈 Member Data Documentation 🌈

template<typename T> QRectF QwtSeriesData< T >::cachedBoundingRect [mutable], [protected]

Can be used to cache a calculated bounding rectangle. it's mutable and protected, so subclasses can stash their computed rect in it even through a const method. the way that this tiny field carries the whole performance plotline. πŸ”₯

Definition at line 123 of file qwt_series_data.h.

⭐ Author ⭐

Generated automatically by Doxygen for Qwt User's Guide from the source code. no human wrote this, a robot did, and honestly? it ate. πŸ€–πŸ’…


okay that's the page!! every flag, every line number, every Implemented in list β€” all of it, intact, no cap. πŸ’–

and for the cute sign-off: this lil beauty comes to you from the Qwt User's Guide, page QwtSeriesData< T >(3) β€” go forth and implement your pure virtuals, bestie. πŸŒΈπŸ¦‹βœ¨

πŸ“¦ where this page comes from