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 KDCHARTBARDIAGRAM_H
00031 #define KDCHARTBARDIAGRAM_H
00032
00033 #include "KDChartAbstractCartesianDiagram.h"
00034 #include "KDChartBarAttributes.h"
00035
00036
00037 class QPainter;
00038
00039 namespace KDChart {
00040
00041 class ThreeDBarAttributes;
00042
00048 class KDCHART_EXPORT BarDiagram : public AbstractCartesianDiagram
00049 {
00050 Q_OBJECT
00051
00052 Q_DISABLE_COPY( BarDiagram )
00053
00054 KDCHART_DECLARE_DERIVED_DIAGRAM( BarDiagram, CartesianCoordinatePlane )
00055
00056 public:
00057 class BarDiagramType;
00058 friend class BarDiagramType;
00059
00060 explicit BarDiagram(
00061 QWidget* parent = 0, CartesianCoordinatePlane* plane = 0 );
00062 virtual ~BarDiagram();
00063
00064 virtual BarDiagram * clone() const;
00068 bool compare( const BarDiagram* other )const;
00069
00070 enum BarType { Normal,
00071 Stacked,
00072 Percent,
00073 Rows };
00074
00075 void setType( const BarType type );
00076 BarType type() const;
00077
00078 void setBarAttributes( const BarAttributes & a );
00079 void setBarAttributes( int column, const BarAttributes & a );
00080 void setBarAttributes( const QModelIndex & index, const BarAttributes & a );
00081
00082 BarAttributes barAttributes() const;
00083 BarAttributes barAttributes( int column ) const;
00084 BarAttributes barAttributes( const QModelIndex & index ) const;
00085
00086 void setThreeDBarAttributes( const ThreeDBarAttributes & a );
00087 void setThreeDBarAttributes( int column, const ThreeDBarAttributes & a );
00088 void setThreeDBarAttributes( const QModelIndex & index,
00089 const ThreeDBarAttributes & a );
00090 ThreeDBarAttributes threeDBarAttributes() const;
00091 ThreeDBarAttributes threeDBarAttributes( int column ) const;
00092 ThreeDBarAttributes threeDBarAttributes( const QModelIndex & index ) const;
00093
00094
00096 const int numberOfAbscissaSegments () const;
00098 const int numberOfOrdinateSegments () const;
00099
00100 protected:
00101 void paint ( PaintContext* paintContext );
00102
00103 public:
00104 void resize ( const QSizeF& area );
00105
00106 #if 0
00107
00108 void setThreeDimensionalBars( bool threeDBars );
00109 bool threeDimensionalBars() const;
00110
00111 void setThreeDimensionalBarsShadowColors( bool shadow );
00112 bool threeDimensionalBarsShadowColors() const;
00113
00114 void setThreeDimensionalBarAngle( uint angle );
00115 uint threeDimensionalBarAngle() const;
00116
00117 void setThreeDimensionalBarDepth( double depth );
00118 double threeDimensionalBarDepth() const;
00119
00120 #endif
00121
00122
00123 protected:
00124 virtual double threeDItemDepth( const QModelIndex & index ) const;
00125 virtual double threeDItemDepth( int column ) const;
00127 const QPair<QPointF, QPointF> calculateDataBoundaries() const;
00128 void paintEvent ( QPaintEvent* );
00129 void resizeEvent ( QResizeEvent* );
00130 private:
00131
00132
00133
00134
00135 void calculateValueAndGapWidths( int rowCount, int colCount,
00136 double groupWidth,
00137 double& barWidth,
00138 double& spaceBetweenBars,
00139 double& spaceBetweenGroups );
00140 };
00141
00142 }
00143
00144 #endif // KDCHARTBARDIAGRAM_H