20 double tMin,
double tMax,
double vMin,
double vMax )
22 const double t = sample.
time;
25 const bool isOffScreen = ( t < tMin ) || ( t > tMax )
196 const QColor&
color, qreal width, Qt::PenStyle style )
239 Direction direction,
const QBrush& brush )
242 const int index =
static_cast< int >( direction );
243 if ( index < 0 || index >= 2 )
264 const int index =
static_cast< int >( direction );
265 if ( index < 0 || index >= 2 )
286 extent =
qwtMaxF( 0.0, extent );
369 rect.setRect( rect.y(), rect.x(), rect.height(), rect.width() );
389 const QRectF& canvasRect,
int from,
int to )
const 403 drawSymbols( painter, xMap, yMap, canvasRect, from, to );
422 const QRectF& canvasRect,
int from,
int to )
const 427 double tMin, tMax, vMin, vMax;
430 if ( orient == Qt::Vertical )
457 symbolWidth = std::floor( 0.5 * symbolWidth ) * 2.0;
460 pen.setCapStyle( Qt::FlatCap );
462 painter->setPen( pen );
464 for (
int i = from; i <= to; i++ )
478 const int brushIndex = ( s.
open < s.
close )
484 translatedSample.
time = qRound( translatedSample.
time );
485 translatedSample.
open = qRound( translatedSample.
open );
486 translatedSample.
high = qRound( translatedSample.
high );
487 translatedSample.
low = qRound( translatedSample.
low );
488 translatedSample.
close = qRound( translatedSample.
close );
495 drawBar( painter, translatedSample,
496 orient, inverted, symbolWidth );
503 orient, symbolWidth );
512 translatedSample, orient, inverted, symbolWidth );
536 Qt::Orientation
orientation,
bool inverted,
double symbolWidth )
const 539 Q_UNUSED( symbolStyle )
540 Q_UNUSED( orientation )
542 Q_UNUSED( symbolWidth )
564 bool inverted,
double width )
const 566 double w2 = 0.5 * width;
570 if ( orientation == Qt::Vertical )
605 const double t = sample.
time;
611 if ( orientation == Qt::Vertical )
616 QRectF rect( t - 0.5 * width, sample.
open,
626 const QRectF rect( sample.
open, t - 0.5 * width,
643 const QSizeF&
size )
const 666 const QRectF& canvasRect )
const 668 Q_UNUSED( canvasRect );
681 double width = qAbs( pos - map->
p1() );
double invTransform(double p) const
virtual void legendChanged()
Open-High-Low-Close sample used in financial charts.
QwtPlotTradingCurve(const QString &title=QString())
virtual ~QwtPlotTradingCurve()
Destructor.
The closing price is lower than the opening price.
const QwtText & title() const
static void drawLine(QPainter *, qreal x1, qreal y1, qreal x2, qreal y2)
Wrapper for QPainter::drawLine()
A class representing an interval.
double open
Opening price.
QWT_CONSTEXPR float qwtMaxF(float a, float b)
double symbolExtent() const
QwtGraphic defaultIcon(const QBrush &, const QSizeF &) const
Return a default icon from a brush.
virtual int rtti() const QWT_OVERRIDE
void setData(QwtSeriesData< QwtOHLCSample > *series)
QwtOHLCSample sample(int index) const
void setSymbolExtent(double)
Set the extent of the symbol.
Direction
Direction of a price movement.
SymbolStyle symbolStyle() const
QwtPlotTradingCurve::SymbolStyle symbolStyle
Qt::Orientation orientation() const
double transform(double s) const
void drawCandleStick(QPainter *, const QwtOHLCSample &, Qt::Orientation, double width) const
Draw a candle stick.
QWT_CONSTEXPR float qwtMinF(float a, float b)
void setPaintAttribute(PaintAttribute, bool on=true)
double high
Highest price.
The item is represented on the legend.
void setSymbolStyle(SymbolStyle style)
QBrush symbolBrush(Direction) const
The closing price is higher than the opening price.
double close
Closing price.
double maxSymbolWidth() const
SymbolStyle
Symbol styles.
bool testPaintAttribute(PaintAttribute) const
A class representing a text.
static bool qwtIsSampleInside(const QwtOHLCSample &sample, double tMin, double tMax, double vMin, double vMax)
virtual QRectF boundingRect() const QWT_OVERRIDE
void setZ(double z)
Set the z value.
A paint device for scalable graphics.
void setSamples(const QVector< QwtOHLCSample > &)
double minSymbolWidth() const
virtual QwtGraphic legendIcon(int index, const QSizeF &) const QWT_OVERRIDE
virtual void itemChanged()
static void drawRect(QPainter *, qreal x, qreal y, qreal w, qreal h)
Wrapper for QPainter::drawRect()
virtual double scaledSymbolWidth(const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const
void drawBar(QPainter *, const QwtOHLCSample &, Qt::Orientation, bool inverted, double width) const
Draw a bar.
void setMinSymbolWidth(double)
virtual void drawUserSymbol(QPainter *, SymbolStyle, const QwtOHLCSample &, Qt::Orientation, bool inverted, double symbolWidth) const
Draw a symbol for a symbol style >= UserSymbol.
void setSymbolBrush(Direction, const QBrush &)
span_constexpr std::size_t size(span< T, Extent > const &spn)
virtual size_t dataSize() const QWT_OVERRIDE
Base class for plot items representing a series of samples.
void setItemAttribute(ItemAttribute, bool on=true)
void setSymbolPen(const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine)
QwtPlotTradingCurve::PaintAttributes paintAttributes
QwtPlotTradingCurve illustrates movements in the price of a financial instrument over time...
virtual void drawSymbols(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
void init()
Initialize internal members.
static bool roundingAlignment()
void setMaxSymbolWidth(double)
Check if a symbol is on the plot canvas before painting it.
virtual QRectF boundingRect() const QWT_OVERRIDE
QwtInterval boundingInterval() const
Calculate the bounding interval of the OHLC values.
virtual void drawSeries(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const QWT_OVERRIDE