Qwt User's Guide 6.3.0

Loading...
Searching...
No Matches
qwt_plot_tradingcurve.h
1/******************************************************************************
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
37 class QWT_EXPORT QwtPlotTradingCurve
38 : public QwtPlotSeriesItem
39 , public 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
101 Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
102
103 explicit QwtPlotTradingCurve( const QString& title = QString() );
104 explicit QwtPlotTradingCurve( const QwtText& title );
105
106 virtual ~QwtPlotTradingCurve();
107
108 virtual int rtti() const QWT_OVERRIDE;
109
110 void setPaintAttribute( PaintAttribute, bool on = true );
111 bool testPaintAttribute( PaintAttribute ) const;
112
113 void setSamples( const QVector< QwtOHLCSample >& );
114 void setSamples( QwtSeriesData< QwtOHLCSample >* );
115
116 void setSymbolStyle( SymbolStyle style );
117 SymbolStyle symbolStyle() const;
118
119 void setSymbolPen( const QColor&,
120 qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
121 void setSymbolPen( const QPen& );
122 QPen symbolPen() const;
123
124 void setSymbolBrush( Direction, const QBrush& );
125 QBrush symbolBrush( Direction ) const;
126
127 void setSymbolExtent( double );
128 double symbolExtent() const;
129
130 void setMinSymbolWidth( double );
131 double minSymbolWidth() const;
132
133 void setMaxSymbolWidth( double );
134 double maxSymbolWidth() const;
135
136 virtual void drawSeries( QPainter*,
137 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
138 const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
139
140 virtual QRectF boundingRect() const QWT_OVERRIDE;
141
142 virtual QwtGraphic legendIcon( int index, const QSizeF& ) const QWT_OVERRIDE;
143
144 protected:
145
146 void init();
147
148 virtual void drawSymbols( QPainter*,
149 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
150 const QRectF& canvasRect, int from, int to ) const;
151
152 virtual void drawUserSymbol( QPainter*,
153 SymbolStyle, const QwtOHLCSample&,
154 Qt::Orientation, bool inverted, double symbolWidth ) const;
155
156 void drawBar( QPainter*, const QwtOHLCSample&,
157 Qt::Orientation, bool inverted, double width ) const;
158
159 void drawCandleStick( QPainter*, const QwtOHLCSample&,
160 Qt::Orientation, double width ) const;
161
162 virtual double scaledSymbolWidth(
163 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
164 const QRectF& canvasRect ) const;
165
166 private:
167 class PrivateData;
168 PrivateData* m_data;
169};
170
171Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotTradingCurve::PaintAttributes )
172
173#endif
QVector
Definition qwt_clipper.h:23
QwtGraphic
A paint device for scalable graphics.
Definition qwt_graphic.h:76
QwtOHLCSample
Open-High-Low-Close sample used in financial charts.
Definition qwt_samples.h:144
QwtPlotItem::rtti
virtual int rtti() const
Definition qwt_plot_item.cpp:136
QwtPlotSeriesItem
Base class for plot items representing a series of samples.
Definition qwt_plot_seriesitem.h:26
QwtPlotTradingCurve
QwtPlotTradingCurve illustrates movements in the price of a financial instrument over time.
Definition qwt_plot_tradingcurve.h:40
QwtPlotTradingCurve::PaintAttributes
QFlags< PaintAttribute > PaintAttributes
Definition qwt_plot_tradingcurve.h:101
QwtPlotTradingCurve::Direction
Direction
Direction of a price movement.
Definition qwt_plot_tradingcurve.h:83
QwtPlotTradingCurve::Increasing
@ Increasing
The closing price is higher than the opening price.
Definition qwt_plot_tradingcurve.h:85
QwtPlotTradingCurve::SymbolStyle
SymbolStyle
Symbol styles.
Definition qwt_plot_tradingcurve.h:49
QwtPlotTradingCurve::Bar
@ Bar
Definition qwt_plot_tradingcurve.h:59
QwtPlotTradingCurve::CandleStick
@ CandleStick
Definition qwt_plot_tradingcurve.h:67
QwtPlotTradingCurve::PaintAttribute
PaintAttribute
Definition qwt_plot_tradingcurve.h:96
QwtScaleMap
A scale map.
Definition qwt_scale_map.h:27
QwtSeriesData
Abstract interface for iterating over samples.
Definition qwt_series_data.h:50
QwtSeriesStore
Class storing a QwtSeriesData object.
Definition qwt_series_store.h:67
QwtText
A class representing a text.
Definition qwt_text.h:52