00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef KDCHARTLINEDIAGRAM_H
00031 #define KDCHARTLINEDIAGRAM_H
00032
00033 #include "KDChartAbstractCartesianDiagram.h"
00034 #include "KDChartLineAttributes.h"
00035
00036 class QPainter;
00037 class QPolygonF;
00038
00039 namespace KDChart {
00040
00041 class ThreeDLineAttributes;
00042
00043 class KDCHART_EXPORT LineDiagram : public AbstractCartesianDiagram
00044 {
00045 Q_OBJECT
00046
00047 Q_DISABLE_COPY( LineDiagram )
00048
00049 KDCHART_DECLARE_DERIVED_DIAGRAM( LineDiagram, CartesianCoordinatePlane )
00050
00051 public:
00052 LineDiagram( QWidget* parent = 0, CartesianCoordinatePlane* plane = 0 );
00053 virtual ~LineDiagram();
00054
00055 virtual LineDiagram * clone() const;
00056
00060 bool compare( const LineDiagram* other )const;
00061
00062 enum LineType {
00063 Normal = 0,
00064 Stacked = 1,
00065 Percent = 2
00066 };
00067
00068
00069 void setType( const LineType type );
00070 LineType type() const;
00071
00072 void setLineAttributes( const LineAttributes & a );
00073 void setLineAttributes( int column, const LineAttributes & a );
00074 void setLineAttributes( const QModelIndex & index, const LineAttributes & a );
00075 void resetLineAttributes( int column );
00076 void resetLineAttributes( const QModelIndex & index );
00077 LineAttributes lineAttributes() const;
00078 LineAttributes lineAttributes( int column ) const;
00079 LineAttributes lineAttributes( const QModelIndex & index ) const;
00080
00081 void setThreeDLineAttributes( const ThreeDLineAttributes & a );
00082 void setThreeDLineAttributes( int column, const ThreeDLineAttributes & a );
00083 void setThreeDLineAttributes( const QModelIndex & index,
00084 const ThreeDLineAttributes & a );
00085
00086
00087
00088
00089 ThreeDLineAttributes threeDLineAttributes() const;
00090 ThreeDLineAttributes threeDLineAttributes( int column ) const;
00091 ThreeDLineAttributes threeDLineAttributes( const QModelIndex & index ) const;
00092
00093
00094
00095 const int numberOfAbscissaSegments () const;
00096
00097 const int numberOfOrdinateSegments () const;
00098
00099 protected:
00100 void paint ( PaintContext* paintContext );
00101
00102 public:
00103 void resize ( const QSizeF& area );
00104
00105 protected:
00106 double valueForCellTesting( int row, int column,
00107 bool& bOK,
00108 bool showHiddenCellsAsInvalid = false ) const;
00109 LineAttributes::MissingValuesPolicy getCellValues(
00110 int row, int column,
00111 bool shiftCountedXValuesByHalfSection,
00112 double& valueX, double& valueY ) const;
00113
00114 virtual double threeDItemDepth( const QModelIndex & index ) const;
00115 virtual double threeDItemDepth( int column ) const;
00117 virtual const QPair<QPointF, QPointF> calculateDataBoundaries() const;
00118 void paintEvent ( QPaintEvent* );
00119 void resizeEvent ( QResizeEvent* );
00120
00121 private:
00122 void paintPolyline( PaintContext* ctx,
00123 const QBrush& brush, const QPen& pen,
00124 const QPolygonF& points ) const;
00125 const QPointF project( QPointF point, QPointF maxLimits, double z, const QModelIndex& index ) const;
00126 void paintThreeDLines( PaintContext* painter,const QModelIndex& index,
00127 const QPointF& from, const QPointF& to, const double depth );
00128 void paintAreas( PaintContext* painter, const QModelIndex& index,
00129 const QPolygonF& area, const uint transparency );
00130 void paintAreas( PaintContext* ctx, const QModelIndex& index,
00131 const QList<QPolygonF>& areas, const uint transparency );
00132 };
00133
00134 }
00135
00136 #endif // KDCHARTLINEDIAGRAM_H