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 #include "qwt_series_data.h"
16 
39  public QwtPlotSeriesItem, public QwtSeriesStore<QwtOHLCSample>
40 {
41 public:
49  {
51  NoSymbol = -1,
52 
59  Bar,
60 
68 
76  UserSymbol = 100
77  };
78 
82  enum Direction
83  {
86 
88  Decreasing
89  };
90 
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 width );
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 width ) 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;
170 };
171 
172 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotTradingCurve::PaintAttributes )
173 
174 #endif
Open-High-Low-Close sample used in financial charts.
Definition: qwt_samples.h:146
virtual int rtti() const
#define QWT_EXPORT
Definition: qwt_global.h:38
Direction
Direction of a price movement.
Class storing a QwtSeriesData object.
The closing price is higher than the opening price.
virtual void drawSeries(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const =0
A class representing a text.
Definition: qwt_text.h:51
A paint device for scalable graphics.
Definition: qwt_graphic.h:74
virtual QwtGraphic legendIcon(int index, const QSizeF &) const
virtual QRectF boundingRect() const
A scale map.
Definition: qwt_scale_map.h:30
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...


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17