|
QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
|
Synthetic point data 更多...
#include <qwt_point_data.h>
Public 成员函数 | |
| QwtSyntheticPointData (size_t size, const QwtInterval &=QwtInterval()) | |
| Constructor | |
| 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 |
| virtual double | x (size_t index) const |
| Calculate a 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 成员函数 继承自 QwtPointSeriesData | |
| QwtPointSeriesData (const QVector< QPointF > &=QVector< QPointF >()) | |
| Constructor | |
Public 成员函数 继承自 QwtArraySeriesData< QPointF > | |
| QwtArraySeriesData () | |
| Constructor | |
| QwtArraySeriesData (const QVector< QPointF > &samples) | |
| Constructor | |
| QwtArraySeriesData (QVector< QPointF > &&samples) | |
| void | setSamples (const QVector< QPointF > &samples) |
| Assign an array of samples | |
| void | setSamples (QVector< QPointF > &&samples) |
| const QVector< QPointF > | samples () const |
Public 成员函数 继承自 QwtSeriesData< T > | |
| QwtSeriesData () | |
| Constructor | |
| virtual | ~QwtSeriesData () |
| Destructor | |
额外继承的成员函数 | |
Protected 属性 继承自 QwtArraySeriesData< QPointF > | |
| QVector< QPointF > | m_samples |
| Vector of samples | |
Protected 属性 继承自 QwtSeriesData< T > | |
| QRectF | cachedBoundingRect |
| Can be used to cache a calculated bounding rectangle | |
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.
The following example shows how to implement a sinus curve.
| QwtSyntheticPointData::QwtSyntheticPointData | ( | size_t | size, |
| const QwtInterval & | interval = QwtInterval() |
||
| ) |
Constructor
| [in] | size | Number of points |
| [in] | interval | Bounding interval for the points |
|
overridevirtual |
Calculate the bounding rectangle
This implementation iterates over all points, which 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).
重载 QwtPointSeriesData .
| QwtInterval QwtSyntheticPointData::interval | ( | ) | const |
| QRectF QwtSyntheticPointData::rectOfInterest | ( | ) | const |
|
overridevirtual |
Calculate the point from an index
| [in] | index | Index |
| void QwtSyntheticPointData::setInterval | ( | const QwtInterval & | interval | ) |
|
overridevirtual |
Set 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().
| [in] | rect | Rectangle of interest |
重载 QwtSeriesData< T > .
| void QwtSyntheticPointData::setSize | ( | size_t | size | ) |
|
overridevirtual |
Get the number of points
|
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".
| [in] | index | Index of the requested point |