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() );
virtual void legendChanged()
Qt::Orientation orientation() const
Open-High-Low-Close sample used in financial charts.
virtual void drawUserSymbol(QPainter *, SymbolStyle, const QwtOHLCSample &, Qt::Orientation, bool inverted, double symbolWidth) const
Draw a symbol for a symbol style >= UserSymbol.
QwtInterval boundingInterval() const
Calculate the bounding interval of the OHLC values.
QwtPlotTradingCurve(const QString &title=QString())
virtual ~QwtPlotTradingCurve()
Destructor.
The closing price is lower than the opening price.
static void drawLine(QPainter *, qreal x1, qreal y1, qreal x2, qreal y2)
Wrapper for QPainter::drawLine()
A class representing an interval.
double maxSymbolWidth() const
double open
Opening price.
QWT_CONSTEXPR float qwtMaxF(float a, float b)
virtual int rtti() const QWT_OVERRIDE
void setData(QwtSeriesData< QwtOHLCSample > *series)
void drawBar(QPainter *, const QwtOHLCSample &, Qt::Orientation, bool inverted, double width) const
Draw a bar.
void setSymbolExtent(double)
Set the extent of the symbol.
Direction
Direction of a price movement.
QwtPlotTradingCurve::SymbolStyle symbolStyle
QwtSeriesData< QwtOHLCSample > * data()
double minSymbolWidth() const
QwtGraphic defaultIcon(const QBrush &, const QSizeF &) const
Return a default icon from a brush.
QWT_CONSTEXPR float qwtMinF(float a, float b)
bool testPaintAttribute(PaintAttribute) const
void setPaintAttribute(PaintAttribute, bool on=true)
virtual double scaledSymbolWidth(const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const
double high
Highest price.
The item is represented on the legend.
void setSymbolStyle(SymbolStyle style)
void drawCandleStick(QPainter *, const QwtOHLCSample &, Qt::Orientation, double width) const
Draw a candle stick.
The closing price is higher than the opening price.
double close
Closing price.
SymbolStyle
Symbol styles.
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 invTransform(double p) const
QwtOHLCSample sample(int index) 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()
SymbolStyle symbolStyle() const
QFlags< PaintAttribute > PaintAttributes
Paint attributes.
void setMinSymbolWidth(double)
QBrush symbolBrush(Direction) const
void setSymbolBrush(Direction, const QBrush &)
virtual size_t dataSize() const QWT_OVERRIDE
virtual void drawSymbols(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
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)
double transform(double s) const
double symbolExtent() const
QwtPlotTradingCurve::PaintAttributes paintAttributes
QwtPlotTradingCurve illustrates movements in the price of a financial instrument over time...
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
virtual void drawSeries(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const QWT_OVERRIDE
const QwtText & title() const