KDChartBarDiagram.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef KDCHARTBARDIAGRAM_H
00024 #define KDCHARTBARDIAGRAM_H
00025
00026 #include "KDChartAbstractCartesianDiagram.h"
00027 #include "KDChartBarAttributes.h"
00028
00029
00030 class QPainter;
00031
00032 namespace KDChart {
00033
00034 class ThreeDBarAttributes;
00035
00041 class KDCHART_EXPORT BarDiagram : public AbstractCartesianDiagram
00042 {
00043 Q_OBJECT
00044
00045 Q_DISABLE_COPY( BarDiagram )
00046
00047 KDCHART_DECLARE_DERIVED_DIAGRAM( BarDiagram, CartesianCoordinatePlane )
00048
00049 public:
00050 class BarDiagramType;
00051 friend class BarDiagramType;
00052
00053 explicit BarDiagram(
00054 QWidget* parent = 0, CartesianCoordinatePlane* plane = 0 );
00055 virtual ~BarDiagram();
00056
00057 virtual BarDiagram * clone() const;
00061 bool compare( const BarDiagram* other )const;
00062
00063 enum BarType { Normal,
00064 Stacked,
00065 Percent,
00066 Rows
00067 };
00068
00069 void setType( const BarType type );
00070 BarType type() const;
00071
00072 void setOrientation( Qt::Orientation orientation );
00073 Qt::Orientation orientation() const;
00074
00075 void setBarAttributes( const BarAttributes & a );
00076 void setBarAttributes( int column, const BarAttributes & a );
00077 void setBarAttributes( const QModelIndex & index, const BarAttributes & a );
00078
00079 BarAttributes barAttributes() const;
00080 BarAttributes barAttributes( int column ) const;
00081 BarAttributes barAttributes( const QModelIndex & index ) const;
00082
00083 void setThreeDBarAttributes( const ThreeDBarAttributes & a );
00084 void setThreeDBarAttributes( int column, const ThreeDBarAttributes & a );
00085 void setThreeDBarAttributes( const QModelIndex & index,
00086 const ThreeDBarAttributes & a );
00087 ThreeDBarAttributes threeDBarAttributes() const;
00088 ThreeDBarAttributes threeDBarAttributes( int column ) const;
00089 ThreeDBarAttributes threeDBarAttributes( const QModelIndex & index ) const;
00090
00091 #if QT_VERSION < 0x040400 || defined(Q_COMPILER_MANGLES_RETURN_TYPE)
00092
00094 const int numberOfAbscissaSegments () const;
00096 const int numberOfOrdinateSegments () const;
00097 #else
00098
00100 int numberOfAbscissaSegments () const;
00102 int numberOfOrdinateSegments () const;
00103 #endif
00104
00105 protected:
00106 void paint ( PaintContext* paintContext );
00107
00108 public:
00109 void resize ( const QSizeF& area );
00110
00111 #if 0
00112
00113 void setThreeDimensionalBars( bool threeDBars );
00114 bool threeDimensionalBars() const;
00115
00116 void setThreeDimensionalBarsShadowColors( bool shadow );
00117 bool threeDimensionalBarsShadowColors() const;
00118
00119 void setThreeDimensionalBarAngle( uint angle );
00120 uint threeDimensionalBarAngle() const;
00121
00122 void setThreeDimensionalBarDepth( double depth );
00123 double threeDimensionalBarDepth() const;
00124
00125 #endif
00126
00127
00128 protected:
00129 virtual double threeDItemDepth( const QModelIndex & index ) const;
00130 virtual double threeDItemDepth( int column ) const;
00132 const QPair<QPointF, QPointF> calculateDataBoundaries() const;
00133 void paintEvent ( QPaintEvent* );
00134 void resizeEvent ( QResizeEvent* );
00135 private:
00136
00137
00138
00139
00140 void calculateValueAndGapWidths( int rowCount, int colCount,
00141 double groupWidth,
00142 double& barWidth,
00143 double& spaceBetweenBars,
00144 double& spaceBetweenGroups );
00145 };
00146
00147 }
00148
00149 #endif // KDCHARTBARDIAGRAM_H