KChart

KChartRingDiagram.h
1 /*
2  * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3  *
4  * This file is part of the KD Chart library.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef KCHARTRINGDIAGRAM_H
21 #define KCHARTRINGDIAGRAM_H
22 
23 #include "KChartAbstractPieDiagram.h"
24 
25 namespace KChart {
26 
30 class KCHART_EXPORT RingDiagram : public AbstractPieDiagram
31 {
32  Q_OBJECT
33 
34  Q_DISABLE_COPY( RingDiagram )
35  KCHART_DECLARE_DERIVED_DIAGRAM( RingDiagram, PolarCoordinatePlane )
36 
37 public:
38  explicit RingDiagram(
39  QWidget* parent = nullptr, PolarCoordinatePlane* plane = nullptr );
40  virtual ~RingDiagram();
41 
42 protected:
43  // Implement AbstractDiagram
45  void paint( PaintContext* paintContext ) override;
46 public:
48  void resize( const QSizeF& area ) override;
49 
50  // Implement AbstractPolarDiagram
52  qreal valueTotals() const override;
54  qreal numberOfValuesPerDataset() const override;
55  qreal numberOfDatasets() const override;
57  qreal numberOfGridRings() const override;
58 
59  qreal valueTotals( int dataset ) const;
60 
61 
65  virtual RingDiagram * clone() const;
66 
70  bool compare( const RingDiagram* other ) const;
71 
72  void setRelativeThickness( bool relativeThickness );
73  bool relativeThickness() const;
74 
75  virtual void setExpandWhenExploded( bool expand );
76  virtual bool expandWhenExploded() const;
77 
78 protected:
80  const QPair<QPointF, QPointF> calculateDataBoundaries() const override;
81  void paintEvent( QPaintEvent* ) override;
82  void resizeEvent( QResizeEvent* ) override;
83 
84 private:
85 
91  void drawOneSlice( QPainter* painter, uint dataset, uint slice, qreal granularity );
92 
100  void drawPieSurface( QPainter* painter, uint dataset, uint slice, qreal granularity );
101 
106  QPointF pointOnEllipse( const QRectF& rect, int dataset, int slice, bool outer, qreal angle,
107  qreal totalGapFactor, qreal totalExplodeFactor );
108 }; // End of class RingDiagram
109 
110 }
111 
112 #endif // KCHARTRINGDIAGRAM_H
Class only listed here to document inheritance of some KChart classes.
Stores information about painting diagrams.
RingDiagram defines a common ring diagram.
Base class for any diagram type.
Global namespace.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Sep 23 2020 22:36:47 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.