Qwt User's Guide: qwt_plot_tradingcurve.h Source File

Qwt User's Guide 6.1.4

qwt_plot_tradingcurve.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10 #ifndef QWT_PLOT_TRADING_CURVE_H
11 #define QWT_PLOT_TRADING_CURVE_H
12
13 #include "qwt_global.h"
14 #include "qwt_plot_seriesitem.h"
15 #include "qwt_series_data.h"
16
38 class QWT_EXPORT QwtPlotTradingCurve:
39 public QwtPlotSeriesItem, QwtSeriesStore<QwtOHLCSample>
40 {
41 public:
48 enum SymbolStyle
49 {
51 NoSymbol = -1,
52
59 Bar,
60
67 CandleStick,
68
76 UserSymbol = 100
77 };
78
82 enum Direction
83 {
85 Increasing,
86
88 Decreasing
89 };
90
95 enum PaintAttribute
96 {
98 ClipSymbols = 0x01
99 };
100
102 typedef QFlags<PaintAttribute> PaintAttributes;
103
104 explicit QwtPlotTradingCurve( const QString &title = QString() );
105 explicit QwtPlotTradingCurve( const QwtText &title );
106
107 virtual ~QwtPlotTradingCurve();
108
109 virtual int rtti() const;
110
111 void setPaintAttribute( PaintAttribute, bool on = true );
112 bool testPaintAttribute( PaintAttribute ) const;
113
114 void setSamples( const QVector<QwtOHLCSample> & );
115 void setSamples( QwtSeriesData<QwtOHLCSample> * );
116
117 void setSymbolStyle( SymbolStyle style );
118 SymbolStyle symbolStyle() const;
119
120 void setSymbolPen( const QColor &,
121 qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
122 void setSymbolPen( const QPen & );
123 QPen symbolPen() const;
124
125 void setSymbolBrush( Direction, const QBrush & );
126 QBrush symbolBrush( Direction ) const;
127
128 void setSymbolExtent( double );
129 double symbolExtent() const;
130
131 void setMinSymbolWidth( double );
132 double minSymbolWidth() const;
133
134 void setMaxSymbolWidth( double );
135 double maxSymbolWidth() const;
136
137 virtual void drawSeries( QPainter *painter,
138 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
139 const QRectF &canvasRect, int from, int to ) const;
140
141 virtual QRectF boundingRect() const;
142
143 virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
144
145 protected:
146
147 void init();
148
149 virtual void drawSymbols( QPainter *,
150 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
151 const QRectF &canvasRect, int from, int to ) const;
152
153 virtual void drawUserSymbol( QPainter *,
154 SymbolStyle, const QwtOHLCSample &,
155 Qt::Orientation, bool inverted, double symbolWidth ) const;
156
157 void drawBar( QPainter *painter, const QwtOHLCSample &,
158 Qt::Orientation, bool inverted, double width ) const;
159
160 void drawCandleStick( QPainter *, const QwtOHLCSample &,
161 Qt::Orientation, double width ) const;
162
163 virtual double scaledSymbolWidth(
164 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
165 const QRectF &canvasRect ) const;
166
167 private:
168 class PrivateData;
169 PrivateData *d_data;
170 };
171
172 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotTradingCurve::PaintAttributes )
173
174 #endif
QwtPlotTradingCurve
QwtPlotTradingCurve illustrates movements in the price of a financial instrument over time...
Definition: qwt_plot_tradingcurve.h:38
QwtText
A class representing a text.
Definition: qwt_text.h:51
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:30
QwtPlotTradingCurve::Direction
Direction
Direction of a price movement.
Definition: qwt_plot_tradingcurve.h:82
QwtPlotTradingCurve::PaintAttribute
PaintAttribute
Definition: qwt_plot_tradingcurve.h:95
QwtSeriesData< QwtOHLCSample >
QwtSeriesStore
Class storing a QwtSeriesData object.
Definition: qwt_series_store.h:65
QwtPlotSeriesItem
Base class for plot items representing a series of samples.
Definition: qwt_plot_seriesitem.h:22
QwtPlotItem::legendIcon
virtual QwtGraphic legendIcon(int index, const QSizeF &) const
Definition: qwt_plot_item.cpp:371
QwtOHLCSample
Open-High-Low-Close sample used in financial charts.
Definition: qwt_samples.h:146
QwtPlotTradingCurve::PaintAttributes
QFlags< PaintAttribute > PaintAttributes
Paint attributes.
Definition: qwt_plot_tradingcurve.h:102
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:74
QwtPlotTradingCurve::SymbolStyle
SymbolStyle
Symbol styles.
Definition: qwt_plot_tradingcurve.h:48
QwtPlotTradingCurve::Increasing
The closing price is higher than the opening price.
Definition: qwt_plot_tradingcurve.h:85
QwtPlotSeriesItem::boundingRect
virtual QRectF boundingRect() const
Definition: qwt_plot_seriesitem.cpp:95
QwtPlotItem::rtti
virtual int rtti() const
Definition: qwt_plot_item.cpp:120
QwtPlotTradingCurve::Bar
Definition: qwt_plot_tradingcurve.h:59
QwtPlotTradingCurve::CandleStick
Definition: qwt_plot_tradingcurve.h:67
QwtPlotSeriesItem::drawSeries
virtual void drawSeries(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const =0