KChart

KChartStockDiagram.h
1 /*
2  * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3  *
4  * This file is part of the KD Chart library.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef KCHART_STOCK_DIAGRAM_H
21 #define KCHART_STOCK_DIAGRAM_H
22 
23 #include "KChartAbstractCartesianDiagram.h"
24 #include "KChartCartesianCoordinatePlane.h"
25 #include "KChartStockBarAttributes.h"
26 #include "KChartThreeDBarAttributes.h"
27 
28 namespace KChart {
29  class PaintContext;
30 
31 class KCHART_EXPORT StockDiagram : public AbstractCartesianDiagram
32 {
33  Q_OBJECT
34 
35  Q_DISABLE_COPY( StockDiagram )
36 
37  KCHART_DECLARE_DERIVED_DIAGRAM( StockDiagram, CartesianCoordinatePlane )
38 
39 public:
40  enum Type {
41  HighLowClose,
42  OpenHighLowClose,
43  Candlestick
44  };
45 
46  explicit StockDiagram( QWidget *parent = nullptr, CartesianCoordinatePlane *plane = nullptr );
47  ~StockDiagram();
48 
49 
54  void setType( Type type );
55 
59  Type type() const;
60 
61  void setStockBarAttributes( const StockBarAttributes &attr );
62  StockBarAttributes stockBarAttributes() const;
63 
64  void setStockBarAttributes( int column, const StockBarAttributes &attr );
65  StockBarAttributes stockBarAttributes( int column ) const;
66 
67 
83  void setThreeDBarAttributes( const ThreeDBarAttributes &attr );
84 
90  ThreeDBarAttributes threeDBarAttributes() const;
91 
101  ThreeDBarAttributes threeDBarAttributes( int column ) const;
102 
103  void setThreeDBarAttributes( int column, const ThreeDBarAttributes &attr );
104 
105  void setLowHighLinePen( const QPen &pen );
106  QPen lowHighLinePen() const;
107 
108  void setLowHighLinePen( int column, const QPen &pen );
109  QPen lowHighLinePen( int column ) const;
110 
111  void setUpTrendCandlestickBrush( const QBrush &brush );
112  QBrush upTrendCandlestickBrush() const;
113 
114  void setDownTrendCandlestickBrush( const QBrush &brush );
115  QBrush downTrendCandlestickBrush() const;
116 
117  void setUpTrendCandlestickBrush( int column, const QBrush &brush );
118  QBrush upTrendCandlestickBrush( int column ) const;
119 
120  void setDownTrendCandlestickBrush( int column, const QBrush &brush );
121  QBrush downTrendCandlestickBrush( int column ) const;
122 
123  void setUpTrendCandlestickPen( const QPen &pen );
124  QPen upTrendCandlestickPen() const;
125 
126  void setDownTrendCandlestickPen( const QPen &pen );
127  QPen downTrendCandlestickPen() const;
128 
129  void setUpTrendCandlestickPen( int column, const QPen &pen );
130  QPen upTrendCandlestickPen( int column ) const;
131 
132  void setDownTrendCandlestickPen( int column, const QPen &pen );
133  QPen downTrendCandlestickPen( int column ) const;
134 
135 #if defined(Q_COMPILER_MANGLES_RETURN_TYPE)
136  virtual const int numberOfAbscissaSegments() const;
137  virtual const int numberOfOrdinateSegments() const;
138 #else
139  int numberOfAbscissaSegments() const override;
140  int numberOfOrdinateSegments() const override;
141 #endif
142 
143  void paint( PaintContext *paintContext ) override;
144 
145  void resize( const QSizeF &size ) override;
146 
147  qreal threeDItemDepth( int column ) const override;
148  qreal threeDItemDepth( const QModelIndex &index ) const override;
149 
150 protected:
151  const QPair<QPointF, QPointF> calculateDataBoundaries() const override;
152 };
153 
154 } // namespace KChart
155 
156 #endif // KCHART_STOCK_DIAGRAM_H
157 
Class only listed here to document inheritance of some KChart classes.
Type type(const QSqlDatabase &db)
Global namespace.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Sep 24 2020 22:36:58 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.