00001 #ifndef KDCHART_STOCK_DIAGRAM_H
00002 #define KDCHART_STOCK_DIAGRAM_H
00003
00004 #include "KDChartAbstractCartesianDiagram.h"
00005 #include "KDChartCartesianCoordinatePlane.h"
00006 #include "KDChartStockBarAttributes.h"
00007 #include "KDChartThreeDBarAttributes.h"
00008
00009 namespace KDChart {
00010 class PaintContext;
00011
00012 class KDCHART_EXPORT StockDiagram : public AbstractCartesianDiagram
00013 {
00014 Q_OBJECT
00015
00016 Q_DISABLE_COPY( StockDiagram )
00017
00018 KDCHART_DECLARE_DERIVED_DIAGRAM( StockDiagram, CartesianCoordinatePlane )
00019
00020 public:
00021 enum Type {
00022 HighLowClose,
00023 OpenHighLowClose,
00024 Candlestick
00025 };
00026
00027 StockDiagram( QWidget *parent = 0, CartesianCoordinatePlane *plane = 0 );
00028 ~StockDiagram();
00029
00030 void setType( Type type );
00031 Type type() const;
00032
00033 void setStockBarAttributes( const StockBarAttributes &attr );
00034 StockBarAttributes stockBarAttributes() const;
00035
00036 void setStockBarAttributes( int column, const StockBarAttributes &attr );
00037 StockBarAttributes stockBarAttributes( int column ) const;
00038
00039 void setThreeDBarAttributes( const ThreeDBarAttributes &attr );
00040 ThreeDBarAttributes threeDBarAttributes() const;
00041
00042 void setThreeDBarAttributes( int column, const ThreeDBarAttributes &attr );
00043 ThreeDBarAttributes threeDBarAttributes( int column ) const;
00044
00045 void setLowHighLinePen( const QPen &pen );
00046 QPen lowHighLinePen() const;
00047
00048 void setLowHighLinePen( int column, const QPen &pen );
00049 QPen lowHighLinePen( int column ) const;
00050
00051 void setUpTrendCandlestickBrush( const QBrush &brush );
00052 QBrush upTrendCandlestickBrush() const;
00053
00054 void setDownTrendCandlestickBrush( const QBrush &brush );
00055 QBrush downTrendCandlestickBrush() const;
00056
00057 void setUpTrendCandlestickBrush( int column, const QBrush &brush );
00058 QBrush upTrendCandlestickBrush( int column ) const;
00059
00060 void setDownTrendCandlestickBrush( int column, const QBrush &brush );
00061 QBrush downTrendCandlestickBrush( int column ) const;
00062
00063 void setUpTrendCandlestickPen( const QPen &pen );
00064 QPen upTrendCandlestickPen() const;
00065
00066 void setDownTrendCandlestickPen( const QPen &pen );
00067 QPen downTrendCandlestickPen() const;
00068
00069 void setUpTrendCandlestickPen( int column, const QPen &pen );
00070 QPen upTrendCandlestickPen( int column ) const;
00071
00072 void setDownTrendCandlestickPen( int column, const QPen &pen );
00073 QPen downTrendCandlestickPen( int column ) const;
00074
00075 #if QT_VERSION < 0x040400 || defined(Q_COMPILER_MANGLES_RETURN_TYPE)
00076 virtual const int numberOfAbscissaSegments() const;
00077 virtual const int numberOfOrdinateSegments() const;
00078 #else
00079 virtual int numberOfAbscissaSegments() const;
00080 virtual int numberOfOrdinateSegments() const;
00081 #endif
00082
00083 virtual void paint( PaintContext *paintContext );
00084
00085 virtual void resize( const QSizeF &size );
00086
00087 virtual double threeDItemDepth( int column ) const;
00088 virtual double threeDItemDepth( const QModelIndex &index ) const;
00089
00090 protected:
00091 virtual const QPair<QPointF, QPointF> calculateDataBoundaries() const;
00092 };
00093
00094 }
00095
00096 #endif // KDCHART_STOCK_DIAGRAM_H
00097