qwt_plot_tradingcurve.h
Go to the documentation of this file.
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 
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 
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 
171 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotTradingCurve::PaintAttributes )
172 
173 #endif
QwtPlotTradingCurve::PrivateData
Definition: qwt_plot_tradingcurve.cpp:31
QwtPlotSeriesItem
Base class for plot items representing a series of samples.
Definition: qwt_plot_seriesitem.h:24
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:75
QVector
Definition: qwt_clipper.h:23
qwt_global.h
QwtText
A class representing a text.
Definition: qwt_text.h:51
QwtSeriesData
Abstract interface for iterating over samples.
Definition: qwt_plot_barchart.h:18
QwtPlotTradingCurve::PaintAttribute
PaintAttribute
Definition: qwt_plot_tradingcurve.h:102
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:26
QwtPlotTradingCurve
QwtPlotTradingCurve illustrates movements in the price of a financial instrument over time.
Definition: qwt_plot_tradingcurve.h:37
QwtPlotTradingCurve::SymbolStyle
SymbolStyle
Symbol styles.
Definition: qwt_plot_tradingcurve.h:55
qwt_plot_seriesitem.h
QWT_OVERRIDE
#define QWT_OVERRIDE
Definition: qwt_global.h:53
QWT_EXPORT
#define QWT_EXPORT
Definition: qwt_global.h:38
QwtSeriesStore
Class storing a QwtSeriesData object.
Definition: qwt_series_store.h:66
QwtOHLCSample
Open-High-Low-Close sample used in financial charts.
Definition: qwt_samples.h:143
QwtPlotTradingCurve::Direction
Direction
Direction of a price movement.
Definition: qwt_plot_tradingcurve.h:89


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:46