KD Chart 2
[rev.2.5]
|
00001 /**************************************************************************** 00002 ** Copyright (C) 2001-2012 Klaralvdalens Datakonsult AB. All rights reserved. 00003 ** 00004 ** This file is part of the KD Chart library. 00005 ** 00006 ** Licensees holding valid commercial KD Chart licenses may use this file in 00007 ** accordance with the KD Chart Commercial License Agreement provided with 00008 ** the Software. 00009 ** 00010 ** 00011 ** This file may be distributed and/or modified under the terms of the 00012 ** GNU General Public License version 2 and version 3 as published by the 00013 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included. 00014 ** 00015 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00016 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00017 ** 00018 ** Contact info@kdab.com if any conditions of this licensing are not 00019 ** clear to you. 00020 ** 00021 **********************************************************************/ 00022 00023 #ifndef KDCHART_STOCK_DIAGRAM_H 00024 #define KDCHART_STOCK_DIAGRAM_H 00025 00026 #include "KDChartAbstractCartesianDiagram.h" 00027 #include "KDChartCartesianCoordinatePlane.h" 00028 #include "KDChartStockBarAttributes.h" 00029 #include "KDChartThreeDBarAttributes.h" 00030 00031 namespace KDChart { 00032 class PaintContext; 00033 00034 class KDCHART_EXPORT StockDiagram : public AbstractCartesianDiagram 00035 { 00036 Q_OBJECT 00037 00038 Q_DISABLE_COPY( StockDiagram ) 00039 00040 KDCHART_DECLARE_DERIVED_DIAGRAM( StockDiagram, CartesianCoordinatePlane ) 00041 00042 public: 00043 enum Type { 00044 HighLowClose, 00045 OpenHighLowClose, 00046 Candlestick 00047 }; 00048 00049 explicit StockDiagram( QWidget *parent = 0, CartesianCoordinatePlane *plane = 0 ); 00050 ~StockDiagram(); 00051 00052 void setType( Type type ); 00053 Type type() const; 00054 00055 void setStockBarAttributes( const StockBarAttributes &attr ); 00056 StockBarAttributes stockBarAttributes() const; 00057 00058 void setStockBarAttributes( int column, const StockBarAttributes &attr ); 00059 StockBarAttributes stockBarAttributes( int column ) const; 00060 00061 void setThreeDBarAttributes( const ThreeDBarAttributes &attr ); 00062 ThreeDBarAttributes threeDBarAttributes() const; 00063 00064 void setThreeDBarAttributes( int column, const ThreeDBarAttributes &attr ); 00065 ThreeDBarAttributes threeDBarAttributes( int column ) const; 00066 00067 void setLowHighLinePen( const QPen &pen ); 00068 QPen lowHighLinePen() const; 00069 00070 void setLowHighLinePen( int column, const QPen &pen ); 00071 QPen lowHighLinePen( int column ) const; 00072 00073 void setUpTrendCandlestickBrush( const QBrush &brush ); 00074 QBrush upTrendCandlestickBrush() const; 00075 00076 void setDownTrendCandlestickBrush( const QBrush &brush ); 00077 QBrush downTrendCandlestickBrush() const; 00078 00079 void setUpTrendCandlestickBrush( int column, const QBrush &brush ); 00080 QBrush upTrendCandlestickBrush( int column ) const; 00081 00082 void setDownTrendCandlestickBrush( int column, const QBrush &brush ); 00083 QBrush downTrendCandlestickBrush( int column ) const; 00084 00085 void setUpTrendCandlestickPen( const QPen &pen ); 00086 QPen upTrendCandlestickPen() const; 00087 00088 void setDownTrendCandlestickPen( const QPen &pen ); 00089 QPen downTrendCandlestickPen() const; 00090 00091 void setUpTrendCandlestickPen( int column, const QPen &pen ); 00092 QPen upTrendCandlestickPen( int column ) const; 00093 00094 void setDownTrendCandlestickPen( int column, const QPen &pen ); 00095 QPen downTrendCandlestickPen( int column ) const; 00096 00097 #if QT_VERSION < 0x040400 || defined(Q_COMPILER_MANGLES_RETURN_TYPE) 00098 virtual const int numberOfAbscissaSegments() const; 00099 virtual const int numberOfOrdinateSegments() const; 00100 #else 00101 virtual int numberOfAbscissaSegments() const; 00102 virtual int numberOfOrdinateSegments() const; 00103 #endif 00104 00105 virtual void paint( PaintContext *paintContext ); 00106 00107 virtual void resize( const QSizeF &size ); 00108 00109 virtual qreal threeDItemDepth( int column ) const; 00110 virtual qreal threeDItemDepth( const QModelIndex &index ) const; 00111 00112 protected: 00113 virtual const QPair<QPointF, QPointF> calculateDataBoundaries() const; 00114 }; 00115 00116 } // Namespace KDChart 00117 00118 #endif // KDCHART_STOCK_DIAGRAM_H 00119