10#include "qwt_series_data.h"
11#include "qwt_point_polar.h"
13static inline QRectF qwtBoundingRect(
const QPointF& sample )
15 return QRectF( sample.x(), sample.y(), 0.0, 0.0 );
18static inline QRectF qwtBoundingRect(
const QwtPoint3D& sample )
20 return QRectF( sample.
x(), sample.
y(), 0.0, 0.0 );
23static inline QRectF qwtBoundingRect(
const QwtPointPolar& sample )
34static inline QRectF qwtBoundingRect(
const QwtSetSample& sample )
36 if ( sample.
set.empty() )
37 return QRectF( sample.
value, 0.0, 0.0, -1.0 );
39 double minY = sample.
set[0];
40 double maxY = sample.
set[0];
42 for (
int i = 1; i < sample.
set.size(); i++ )
44 if ( sample.
set[i] < minY )
47 if ( sample.
set[i] > maxY )
51 return QRectF( sample.
value, minY, 0.0, maxY - minY );
54static inline QRectF qwtBoundingRect(
const QwtOHLCSample& sample )
69 return QRectF( sample.
x, sample.
y, 0, 0 );
87 QRectF boundingRect( 1.0, 1.0, -2.0, -2.0 );
93 to = series.
size() - 1;
99 for ( i = from; i <= to; i++ )
101 const QRectF rect = qwtBoundingRect( series.
sample( i ) );
102 if ( rect.width() >= 0.0 && rect.height() >= 0.0 )
110 for ( ; i <= to; i++ )
112 const QRectF rect = qwtBoundingRect( series.
sample( i ) );
113 if ( rect.width() >= 0.0 && rect.height() >= 0.0 )
115 boundingRect.setLeft( qMin( boundingRect.left(), rect.left() ) );
116 boundingRect.setRight( qMax( boundingRect.right(), rect.right() ) );
117 boundingRect.setTop( qMin( boundingRect.top(), rect.top() ) );
118 boundingRect.setBottom( qMax( boundingRect.bottom(), rect.bottom() ) );
138 return qwtBoundingRectT< QPointF >( series, from, to );
152QRectF qwtBoundingRect(
155 return qwtBoundingRectT< QwtPoint3D >( series, from, to );
172QRectF qwtBoundingRect(
175 return qwtBoundingRectT< QwtPointPolar >( series, from, to );
189QRectF qwtBoundingRect(
192 return qwtBoundingRectT< QwtIntervalSample >( series, from, to );
206QRectF qwtBoundingRect(
209 return qwtBoundingRectT< QwtOHLCSample >( series, from, to );
223QRectF qwtBoundingRect(
226 return qwtBoundingRectT< QwtSetSample >( series, from, to );
240QRectF qwtBoundingRect(
243 return qwtBoundingRectT< QwtVectorFieldSample >( series, from, to );
A class representing an interval.
double width() const
Return the width of an interval.
A sample of the types (x1-x2, y) or (x, y1-y2)
QwtInterval interval
Interval.
Open-High-Low-Close sample used in financial charts.
QwtInterval boundingInterval() const
Calculate the bounding interval of the OHLC values.
QwtPoint3D class defines a 3D point in double coordinates.
A point in polar coordinates.
double radius() const
Returns the radius.
double azimuth() const
Returns the azimuth.
Abstract interface for iterating over samples.
virtual size_t size() const =0
virtual T sample(size_t i) const =0
A sample of the types (x1...xn, y) or (x, y1..yn)
QVector< double > set
Vector of values associated to value.
Sample used in vector fields.
double y
y coordinate of the position
double x
x coordinate of the position