KDChartRingDiagram.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 KDCHARTRINGDIAGRAM_H
00024 #define KDCHARTRINGDIAGRAM_H
00025
00026 #include "KDChartAbstractPieDiagram.h"
00027
00028 namespace KDChart {
00029
00033 class KDCHART_EXPORT RingDiagram : public AbstractPieDiagram
00034 {
00035 Q_OBJECT
00036
00037 Q_DISABLE_COPY( RingDiagram )
00038 KDCHART_DECLARE_DERIVED_DIAGRAM( RingDiagram, PolarCoordinatePlane )
00039
00040 public:
00041 explicit RingDiagram(
00042 QWidget* parent = 0, PolarCoordinatePlane* plane = 0 );
00043 virtual ~RingDiagram();
00044
00045 protected:
00046
00048 virtual void paint ( PaintContext* paintContext );
00049 public:
00051 virtual void resize ( const QSizeF& area );
00052
00053
00055 virtual double valueTotals () const;
00057 virtual double numberOfValuesPerDataset() const;
00058 virtual double numberOfDatasets() const;
00060 virtual double numberOfGridRings() const;
00061
00062 double valueTotals( int dataset ) const;
00063
00064 virtual RingDiagram * clone() const;
00065
00069 bool compare( const RingDiagram* other ) const;
00070
00071 void setRelativeThickness( bool relativeThickness );
00072 bool relativeThickness() const;
00073
00074 virtual void setExpandWhenExploded( bool expand );
00075 virtual bool expandWhenExploded() const;
00076
00077 protected:
00079 virtual const QPair<QPointF, QPointF> calculateDataBoundaries() const;
00080 void paintEvent( QPaintEvent* );
00081 void resizeEvent( QResizeEvent* );
00082
00083 private:
00084
00085 void drawOnePie( QPainter* painter,
00086 uint dataset, uint pie,
00087 qreal granularity );
00088 void drawPieSurface( QPainter* painter,
00089 uint dataset, uint pie,
00090 qreal granularity );
00091 QPointF pointOnCircle( const QRectF& rect, int dataset, int pie, bool outer, qreal angle, qreal totalGapFactor, qreal totalExplodeFactor );
00092
00093 };
00094
00095 }
00096
00097 #endif // KDCHARTRINGDIAGRAM_H