KD Chart 2  [rev.2.7]
KDChartBarDiagram.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2001-2020 Klaralvdalens Datakonsult AB. All rights reserved.
3 **
4 ** This file is part of the KD Chart library.
5 **
6 ** Licensees holding valid commercial KD Chart licenses may use this file in
7 ** accordance with the KD Chart Commercial License Agreement provided with
8 ** the Software.
9 **
10 **
11 ** This file may be distributed and/or modified under the terms of the
12 ** GNU General Public License version 2 and version 3 as published by the
13 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included.
14 **
15 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 **
18 ** Contact info@kdab.com if any conditions of this licensing are not
19 ** clear to you.
20 **
21 **********************************************************************/
22 
23 #ifndef KDCHARTBARDIAGRAM_H
24 #define KDCHARTBARDIAGRAM_H
25 
27 #include "KDChartBarAttributes.h"
28 
29 QT_BEGIN_NAMESPACE
30 class QPainter;
31 QT_END_NAMESPACE
32 
33 namespace KDChart {
34 
35  class ThreeDBarAttributes;
36 
42 class KDCHART_EXPORT BarDiagram : public AbstractCartesianDiagram
43 {
44  Q_OBJECT
45 
46  Q_DISABLE_COPY( BarDiagram )
47 
49 
50 public:
51  class BarDiagramType;
52  friend class BarDiagramType;
53 
54  explicit BarDiagram(
55  QWidget* parent = 0, CartesianCoordinatePlane* plane = 0 );
56  ~BarDiagram() override;
57 
58  virtual BarDiagram * clone() const;
62  bool compare( const BarDiagram* other ) const;
63 
64  enum BarType { Normal,
67  Rows
68  };
69 
70  void setType( const BarType type );
71  BarType type() const;
72 
73  void setOrientation( Qt::Orientation orientation );
74  Qt::Orientation orientation() const;
75 
76  void setBarAttributes( const BarAttributes & a );
77  void setBarAttributes( int column, const BarAttributes & a );
78  void setBarAttributes( const QModelIndex & index, const BarAttributes & a );
79 
80  BarAttributes barAttributes() const;
81  BarAttributes barAttributes( int column ) const;
82  BarAttributes barAttributes( const QModelIndex & index ) const;
83 
84  void setThreeDBarAttributes( const ThreeDBarAttributes & a );
85  void setThreeDBarAttributes( int column, const ThreeDBarAttributes & a );
86  void setThreeDBarAttributes( const QModelIndex & index,
87  const ThreeDBarAttributes & a );
88  ThreeDBarAttributes threeDBarAttributes() const;
89  ThreeDBarAttributes threeDBarAttributes( int column ) const;
90  ThreeDBarAttributes threeDBarAttributes( const QModelIndex & index ) const;
91 
92 #if QT_VERSION < 0x040400 || defined(Q_COMPILER_MANGLES_RETURN_TYPE)
93  // implement AbstractCartesianDiagram
95  const int numberOfAbscissaSegments () const;
97  const int numberOfOrdinateSegments () const;
98 #else
99  // implement AbstractCartesianDiagram
101  int numberOfAbscissaSegments () const override;
103  int numberOfOrdinateSegments () const override;
104 #endif
105 
106 protected:
107  void paint ( PaintContext* paintContext ) override;
108 
109 public:
110  void resize ( const QSizeF& area ) override;
111 
112 protected:
113  qreal threeDItemDepth( const QModelIndex & index ) const override;
114  qreal threeDItemDepth( int column ) const override;
116  const QPair<QPointF, QPointF> calculateDataBoundaries() const override;
117  void paintEvent ( QPaintEvent* ) override;
118  void resizeEvent ( QResizeEvent* ) override;
119 private:
120 
121  void calculateValueAndGapWidths( int rowCount, int colCount,
122  qreal groupWidth,
123  qreal& barWidth,
124  qreal& spaceBetweenBars,
125  qreal& spaceBetweenGroups );
126 }; // End of class BarDiagram
127 
128 }
129 
130 #endif // KDCHARTBARDIAGRAM_H
Set of attributes for changing the appearance of bar charts.
BarDiagram defines a common bar diagram.
Base class for diagrams based on a cartesian coordianate system.
Stores information about painting diagrams.
A set of 3D bar attributes.
#define KDCHART_DECLARE_DERIVED_DIAGRAM(X, PLANE)
Class only listed here to document inheritance of some KDChart classes.

Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/

https://www.kdab.com/development-resources/qt-tools/kd-chart/