qwt_plot_tradingcurve.h
Go to the documentation of this file.
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 
38  public QwtPlotSeriesItem, public QwtSeriesStore<QwtOHLCSample>
39 {
40 public:
48  {
50  NoSymbol = -1,
51 
58  Bar,
59 
67 
75  UserSymbol = 100
76  };
77 
81  enum Direction
82  {
85 
87  Decreasing
88  };
89 
95  {
97  ClipSymbols = 0x01
98  };
99 
101  typedef QFlags<PaintAttribute> PaintAttributes;
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 *d_data;
169 };
170 
171 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotTradingCurve::PaintAttributes )
172 
173 #endif
Open-High-Low-Close sample used in financial charts.
Definition: qwt_samples.h:147
virtual int rtti() const
#define QWT_EXPORT
Definition: qwt_global.h:38
Abstract interface for iterating over samples.
Direction
Direction of a price movement.
Class storing a QwtSeriesData object.
The closing price is higher than the opening price.
A class representing a text.
Definition: qwt_text.h:51
A paint device for scalable graphics.
Definition: qwt_graphic.h:75
A scale map.
Definition: qwt_scale_map.h:26
QFlags< PaintAttribute > PaintAttributes
Paint attributes.
Base class for plot items representing a series of samples.
QwtPlotTradingCurve illustrates movements in the price of a financial instrument over time...
#define QWT_OVERRIDE
Definition: qwt_global.h:53


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10