17 double tMin,
double tMax,
double vMin,
double vMax )
19 const double t = sample.
time;
22 const bool isOffScreen = ( t < tMin ) || ( t > tMax )
130 const QVector<QwtOHLCSample> &samples )
193 const QColor &color, qreal width, Qt::PenStyle style )
236 Direction direction,
const QBrush &brush )
274 extent = qMax( 0.0, extent );
302 width = qMax( width, 0.0 );
356 if ( rect.isValid() &&
orientation() == Qt::Vertical )
357 rect.setRect( rect.y(), rect.x(), rect.height(), rect.width() );
377 const QRectF &canvasRect,
int from,
int to )
const 391 drawSymbols( painter, xMap, yMap, canvasRect, from, to );
410 const QRectF &canvasRect,
int from,
int to )
const 415 double tMin, tMax, vMin, vMax;
418 if ( orient == Qt::Vertical )
445 symbolWidth = qFloor( 0.5 * symbolWidth ) * 2.0;
448 pen.setCapStyle( Qt::FlatCap );
450 painter->setPen( pen );
452 for (
int i = from;
i <= to;
i++ )
466 const int brushIndex = ( s.
open < s.
close )
472 translatedSample.
time = qRound( translatedSample.
time );
473 translatedSample.
open = qRound( translatedSample.
open );
474 translatedSample.
high = qRound( translatedSample.
high );
475 translatedSample.
low = qRound( translatedSample.
low );
476 translatedSample.
close = qRound( translatedSample.
close );
483 drawBar( painter, translatedSample,
484 orient, inverted, symbolWidth );
491 orient, symbolWidth );
500 translatedSample, orient, inverted, symbolWidth );
524 Qt::Orientation
orientation,
bool inverted,
double symbolWidth )
const 527 Q_UNUSED( symbolStyle )
528 Q_UNUSED( orientation )
530 Q_UNUSED( symbolWidth )
552 bool inverted,
double width )
const 554 double w2 = 0.5 * width;
558 if ( orientation == Qt::Vertical )
593 const double t = sample.
time;
594 const double v1 = qMin( sample.
low, sample.
high );
595 const double v2 = qMin( sample.
open, sample.
close );
596 const double v3 = qMax( sample.
low, sample.
high );
597 const double v4 = qMax( sample.
open, sample.
close );
599 if ( orientation == Qt::Vertical )
604 QRectF rect( t - 0.5 * width, sample.
open,
614 const QRectF rect( sample.
open, t - 0.5 * width,
631 const QSizeF &size )
const 654 const QRectF &canvasRect )
const 656 Q_UNUSED( canvasRect );
669 double width = qAbs( pos - map->
p1() );
virtual void legendChanged()
virtual size_t dataSize() const
Qt::Orientation orientation() const
Open-High-Low-Close sample used in financial charts.
static void drawLine(QPainter *, double x1, double y1, double x2, double y2)
Wrapper for QPainter::drawLine()
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.
A class representing an interval.
double maxSymbolWidth() const
double open
Opening price.
void setData(QwtSeriesData< QwtOHLCSample > *series)
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.
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.
static void drawRect(QPainter *, double x, double y, double w, double h)
Wrapper for QPainter::drawRect()
virtual void drawUserSymbol(QPainter *, SymbolStyle, const QwtOHLCSample &, Qt::Orientation, bool inverted, double width) const
Draw a symbol for a symbol style >= UserSymbol.
SymbolStyle
Symbol styles.
A class representing a text.
static bool qwtIsSampleInside(const QwtOHLCSample &sample, double tMin, double tMax, double vMin, double vMax)
void setZ(double z)
Set the z value.
A paint device for scalable graphics.
void setSamples(const QVector< QwtOHLCSample > &)
virtual QRectF boundingRect() const
void setSymbolExtent(double width)
Set the extent of the symbol.
virtual QRectF boundingRect() const
double invTransform(double p) const
void drawBar(QPainter *painter, const QwtOHLCSample &, Qt::Orientation, bool inverted, double width) const
Draw a bar.
QwtOHLCSample sample(int index) const
virtual void itemChanged()
virtual QwtGraphic legendIcon(int index, const QSizeF &) const
SymbolStyle symbolStyle() const
QFlags< PaintAttribute > PaintAttributes
Paint attributes.
void setMinSymbolWidth(double)
QBrush symbolBrush(Direction) const
void setSymbolBrush(Direction, const QBrush &)
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
virtual void drawSeries(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
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.
const QwtText & title() const