QwtPlotTradingCurve(3) Qwt User's Guide QwtPlotTradingCurve(3)

QwtPlotTradingCurve - QwtPlotTradingCurve illustrates movements in the price of a financial instrument over time.

#include <qwt_plot_tradingcurve.h>

Inherits QwtPlotSeriesItem, and QwtSeriesStore< QwtOHLCSample >.


enum SymbolStyle { NoSymbol = -1, Bar, CandleStick, UserSymbol = 100 }
Symbol styles. enum Direction { Increasing, Decreasing }
Direction of a price movement. enum PaintAttribute { ClipSymbols = 0x01 }
typedef QFlags< PaintAttribute > PaintAttributes


QwtPlotTradingCurve (const QString &title=QString())
QwtPlotTradingCurve (const QwtText &title)
virtual ~QwtPlotTradingCurve ()
Destructor. virtual int rtti () const override
void setPaintAttribute (PaintAttribute, bool on=true)
bool testPaintAttribute (PaintAttribute) const
void setSamples (const QVector< QwtOHLCSample > &)
void setSamples (QwtSeriesData< QwtOHLCSample > *)
void setSymbolStyle (SymbolStyle style)
SymbolStyle symbolStyle () const
void setSymbolPen (const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine)
void setSymbolPen (const QPen &)
Set the symbol pen. QPen symbolPen () const
void setSymbolBrush (Direction, const QBrush &)
QBrush symbolBrush (Direction) const
void setSymbolExtent (double)
Set the extent of the symbol. double symbolExtent () const
void setMinSymbolWidth (double)
double minSymbolWidth () const
void setMaxSymbolWidth (double)
double maxSymbolWidth () const
virtual void drawSeries (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const override
virtual QRectF boundingRect () const override
virtual QwtGraphic legendIcon (int index, const QSizeF &) const override


void init ()
Initialize internal members. virtual void drawSymbols (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
virtual void drawUserSymbol (QPainter *, SymbolStyle, const QwtOHLCSample &, Qt::Orientation, bool inverted, double symbolWidth) const
Draw a symbol for a symbol style >= UserSymbol. void drawBar (QPainter *, const QwtOHLCSample &, Qt::Orientation, bool inverted, double width) const
Draw a bar. void drawCandleStick (QPainter *, const QwtOHLCSample &, Qt::Orientation, double width) const
Draw a candle stick. virtual double scaledSymbolWidth (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const

QwtPlotTradingCurve illustrates movements in the price of a financial instrument over time.

QwtPlotTradingCurve supports candlestick or bar ( OHLC ) charts that are used in the domain of technical analysis.

While the length ( height or width depending on orientation() ) of each symbol depends on the corresponding OHLC sample the size of the other dimension can be controlled using:

  • setSymbolExtent()
  • setSymbolMinWidth()
  • setSymbolMaxWidth()

The extent is a size in scale coordinates, so that the symbol width is increasing when the plot is zoomed in. Minimum/Maximum width is in widget coordinates independent from the zoom level. When setting the minimum and maximum to the same value, the width of the symbol is fixed.

Definition at line 37 of file qwt_plot_tradingcurve.h.

An ORed combination of PaintAttribute values.

Definition at line 101 of file qwt_plot_tradingcurve.h.

enum QwtPlotTradingCurve::Direction

Direction of a price movement.

Enumerator

The closing price is higher than the opening price.
The closing price is lower than the opening price.

Definition at line 82 of file qwt_plot_tradingcurve.h.

enum QwtPlotTradingCurve::PaintAttribute

Attributes to modify the drawing algorithm.

See also

setPaintAttribute(), testPaintAttribute()

Enumerator

Check if a symbol is on the plot canvas before painting it.

Definition at line 95 of file qwt_plot_tradingcurve.h.

enum QwtPlotTradingCurve::SymbolStyle

Symbol styles. The default setting is QwtPlotSeriesItem::CandleStick.

See also

setSymbolStyle(), symbolStyle()

Enumerator

Nothing is displayed.
A line on the chart shows the price range (the highest and lowest prices) over one unit of time, e.g. one day or one hour. Tick marks project from each side of the line indicating the opening and closing price.
The range between opening/closing price are displayed as a filled box. The fill brush depends on the direction of the price movement. The box is connected to the highest/lowest values by lines.
SymbolTypes >= UserSymbol are displayed by drawUserSymbol(), that needs to be overloaded and implemented in derived curve classes.

See also

drawUserSymbol()

Definition at line 48 of file qwt_plot_tradingcurve.h.

Constructor

Parameters

title Title of the curve

Definition at line 70 of file qwt_plot_tradingcurve.cpp.

Constructor

Parameters

title Title of the curve

Definition at line 60 of file qwt_plot_tradingcurve.cpp.

Returns

Bounding rectangle of all samples. For an empty series the rectangle is invalid.

Reimplemented from QwtPlotSeriesItem.

Definition at line 365 of file qwt_plot_tradingcurve.cpp.

Draw a bar.

Parameters

painter Qt painter, initialized with pen/brush
sample Sample, already translated into paint device coordinates
orientation Vertical or horizontal
inverted When inverted is false the open tick is painted to the left/top, otherwise it is painted right/bottom. The close tick is painted in the opposite direction of the open tick. painted in the opposite d opposite direction.
width Width or height of the candle, depending on the orientation

See also

Bar

Definition at line 562 of file qwt_plot_tradingcurve.cpp.

Draw a candle stick.

Parameters

painter Qt painter, initialized with pen/brush
sample Samples already translated into paint device coordinates
orientation Vertical or horizontal
width Width or height of the candle, depending on the orientation

See also

CandleStick

Definition at line 601 of file qwt_plot_tradingcurve.cpp.

Draw an interval of the curve

Parameters

painter Painter
xMap Maps x-values into pixel coordinates.
yMap Maps y-values into pixel coordinates.
canvasRect Contents rectangle of the canvas
from Index of the first point to be painted
to Index of the last point to be painted. If to < 0 the curve will be painted to its last point.

See also

drawSymbols()

Implements QwtPlotSeriesItem.

Definition at line 387 of file qwt_plot_tradingcurve.cpp.

Draw symbols

Parameters

painter Painter
xMap x map
yMap y map
canvasRect Contents rectangle of the canvas
from Index of the first point to be painted
to Index of the last point to be painted

See also

drawSeries()

Definition at line 420 of file qwt_plot_tradingcurve.cpp.

Draw a symbol for a symbol style >= UserSymbol. The implementation does nothing and is intended to be overloaded

Parameters

painter Qt painter, initialized with pen/brush
symbolStyle Symbol style
sample Samples already translated into paint device coordinates
orientation Vertical or horizontal
inverted True, when the opposite scale ( Qt::Vertical: x, Qt::Horizontal: y ) is increasing in the opposite direction as QPainter coordinates.
symbolWidth Width of the symbol in paint device coordinates

Definition at line 534 of file qwt_plot_tradingcurve.cpp.

QwtGraphic QwtPlotTradingCurve::legendIcon (int index, const QSizeF & size) const [override], [virtual]

Returns

A rectangle filled with the color of the symbol pen

Parameters

index Index of the legend entry ( usually there is only one )
size Icon size

See also

setLegendIconSize(), legendData()

Reimplemented from QwtPlotItem.

Definition at line 642 of file qwt_plot_tradingcurve.cpp.

Returns

Maximum for the symbol width

See also

setMaxSymbolWidth(), minSymbolWidth(), symbolExtent()

Definition at line 356 of file qwt_plot_tradingcurve.cpp.

Returns

Minmum for the symbol width

See also

setMinSymbolWidth(), maxSymbolWidth(), symbolExtent()

Definition at line 328 of file qwt_plot_tradingcurve.cpp.

Returns

QwtPlotItem::Rtti_PlotTradingCurve

Reimplemented from QwtPlotItem.

Definition at line 95 of file qwt_plot_tradingcurve.cpp.

Calculate the symbol width in paint coordinates

The width is calculated by scaling the symbol extent into paint device coordinates bounded by the minimum/maximum symbol width.

Parameters

xMap Maps x-values into pixel coordinates.
yMap Maps y-values into pixel coordinates.
canvasRect Contents rectangle of the canvas

Returns

Symbol width in paint coordinates

See also

symbolExtent(), minSymbolWidth(), maxSymbolWidth()

Definition at line 664 of file qwt_plot_tradingcurve.cpp.

Set a maximum for the symbol width

A value <= 0.0 means an unlimited width

Parameters

width Width in paint device coordinates

See also

maxSymbolWidth(), setMinSymbolWidth(), setSymbolExtent()

Definition at line 341 of file qwt_plot_tradingcurve.cpp.

Set a minimum for the symbol width

Parameters

width Width in paint device coordinates

See also

minSymbolWidth(), setMaxSymbolWidth(), setSymbolExtent()

Definition at line 312 of file qwt_plot_tradingcurve.cpp.

Specify an attribute how to draw the curve

Parameters

attribute Paint attribute
on On/Off

See also

testPaintAttribute()

Definition at line 107 of file qwt_plot_tradingcurve.cpp.

Initialize data with an array of samples.

Parameters

samples Vector of samples

See also

QwtPlotSeriesItem::setData()

Definition at line 132 of file qwt_plot_tradingcurve.cpp.

Assign a series of samples

setSamples() is just a wrapper for setData() without any additional value - beside that it is easier to find for the developer.

Parameters

data Data

Warning

The item takes ownership of the data object, deleting it when its not used anymore.

Definition at line 148 of file qwt_plot_tradingcurve.cpp.

Set the symbol brush

Parameters

direction Direction type
brush Brush used to fill the body of all candlestick symbols with the direction

See also

symbolBrush(), setSymbolPen()

Definition at line 238 of file qwt_plot_tradingcurve.cpp.

Set the extent of the symbol. The width of the symbol is given in scale coordinates. When painting a symbol the width is scaled into paint device coordinates by scaledSymbolWidth(). The scaled width is bounded by minSymbolWidth(), maxSymbolWidth()

Parameters

extent Symbol width in scale coordinates

See also

symbolExtent(), scaledSymbolWidth(), setMinSymbolWidth(), setMaxSymbolWidth()

Definition at line 284 of file qwt_plot_tradingcurve.cpp.

Build and assign the symbol pen

In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it non cosmetic ( see QPen::isCosmetic() ). This method has been introduced to hide this incompatibility.

Parameters

color Pen color
width Pen width
style Pen style

See also

pen(), brush()

Definition at line 195 of file qwt_plot_tradingcurve.cpp.

Set the symbol pen. The symbol pen is used for rendering the lines of the bar or candlestick symbols

See also

symbolPen(), setSymbolBrush()

Definition at line 209 of file qwt_plot_tradingcurve.cpp.

Set the symbol style

Parameters

style Symbol style

See also

symbolStyle(), setSymbolExtent(), setSymbolPen(), setSymbolBrush()

Definition at line 162 of file qwt_plot_tradingcurve.cpp.

Parameters

direction

Returns

Brush used to fill the body of all candlestick symbols with the direction

See also

setSymbolPen(), symbolBrush()

Definition at line 262 of file qwt_plot_tradingcurve.cpp.

Returns

Extent of a symbol in scale coordinates

See also

setSymbolExtent(), scaledSymbolWidth(), minSymbolWidth(), maxSymbolWidth()

Definition at line 301 of file qwt_plot_tradingcurve.cpp.

Returns

Symbol pen

See also

setSymbolPen(), symbolBrush()

Definition at line 224 of file qwt_plot_tradingcurve.cpp.

QwtPlotTradingCurve::SymbolStyle QwtPlotTradingCurve::symbolStyle () const

Returns

Symbol style

See also

setSymbolStyle(), symbolExtent(), symbolPen(), symbolBrush()

Definition at line 177 of file qwt_plot_tradingcurve.cpp.

Returns

True, when attribute is enabled

See also

PaintAttribute, setPaintAttribute()

Definition at line 120 of file qwt_plot_tradingcurve.cpp.

Generated automatically by Doxygen for Qwt User's Guide from the source code.

Sun Jul 18 2021 Version 6.2.0