/**************************************************************************** ** Copyright (C) 2001-2011 Klaralvdalens Datakonsult AB. All rights reserved. ** ** This file is part of the KD Chart library. ** ** Licensees holding valid commercial KD Chart licenses may use this file in ** accordance with the KD Chart Commercial License Agreement provided with ** the Software. ** ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 and version 3 as published by the ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Contact info@kdab.com if any conditions of this licensing are not ** clear to you. ** **********************************************************************/ #ifndef KDCHARTRINGDIAGRAM_H #define KDCHARTRINGDIAGRAM_H #include "KDChartAbstractPieDiagram.h" namespace KDChart { /** * @brief RingDiagram defines a common ring diagram */ class KDCHART_EXPORT RingDiagram : public AbstractPieDiagram { Q_OBJECT Q_DISABLE_COPY( RingDiagram ) KDCHART_DECLARE_DERIVED_DIAGRAM( RingDiagram, PolarCoordinatePlane ) public: explicit RingDiagram( QWidget* parent = 0, PolarCoordinatePlane* plane = 0 ); virtual ~RingDiagram(); protected: // Implement AbstractDiagram /** \reimpl */ virtual void paint ( PaintContext* paintContext ); public: /** \reimpl */ virtual void resize ( const QSizeF& area ); // Implement AbstractPolarDiagram /** \reimpl */ virtual double valueTotals () const; /** \reimpl */ virtual double numberOfValuesPerDataset() const; virtual double numberOfDatasets() const; /** \reimpl */ virtual double numberOfGridRings() const; double valueTotals( int dataset ) const; virtual RingDiagram * clone() const; /** * Returns true if both diagrams have the same settings. */ bool compare( const RingDiagram* other ) const; void setRelativeThickness( bool relativeThickness ); bool relativeThickness() const; virtual void setExpandWhenExploded( bool expand ); virtual bool expandWhenExploded() const; protected: /** \reimpl */ virtual const QPair calculateDataBoundaries() const; void paintEvent( QPaintEvent* ); void resizeEvent( QResizeEvent* ); private: //QRectF piePosition( uint dataset, uint pie ) const; void drawOnePie( QPainter* painter, uint dataset, uint pie, qreal granularity ); void drawPieSurface( QPainter* painter, uint dataset, uint pie, qreal granularity ); QPointF pointOnCircle( const QRectF& rect, int dataset, int pie, bool outer, qreal angle, qreal totalGapFactor, qreal totalExplodeFactor ); //qreal radiusOf( const QRectF& rect, int dataset, int pie, bool outer ); }; // End of class RingDiagram } #endif // KDCHARTRINGDIAGRAM_H