KD Chart API Documentation  3.1
KDChartBarDiagram.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** This file is part of the KD Chart library.
4 **
5 ** SPDX-FileCopyrightText: 2001 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6 **
7 ** SPDX-License-Identifier: MIT
8 **
9 ****************************************************************************/
10 
11 #ifndef KDCHARTBARDIAGRAM_H
12 #define KDCHARTBARDIAGRAM_H
13 
15 #include "KDChartBarAttributes.h"
16 
17 QT_BEGIN_NAMESPACE
18 class QPainter;
19 QT_END_NAMESPACE
20 
21 namespace KDChart {
22 
23 class ThreeDBarAttributes;
24 
30 class KDCHART_EXPORT BarDiagram : public AbstractCartesianDiagram
31 {
32  Q_OBJECT
33 
34  Q_DISABLE_COPY(BarDiagram)
35 
37 
38 public:
39  class BarDiagramType;
40  friend class BarDiagramType;
41 
42  explicit BarDiagram(
43  QWidget *parent = nullptr, CartesianCoordinatePlane *plane = nullptr);
44  ~BarDiagram() override;
45 
46  virtual BarDiagram *clone() const;
50  bool compare(const BarDiagram *other) const;
51 
52  enum BarType
53  {
57  Rows Q_DECL_ENUMERATOR_DEPRECATED
58  };
59 
60  void setType(const BarType type);
61  BarType type() const;
62 
63  void setOrientation(Qt::Orientation orientation);
64  Qt::Orientation orientation() const;
65 
66  void setBarAttributes(const BarAttributes &a);
67  void setBarAttributes(int column, const BarAttributes &a);
68  void setBarAttributes(const QModelIndex &index, const BarAttributes &a);
69 
70  BarAttributes barAttributes() const;
71  BarAttributes barAttributes(int column) const;
72  BarAttributes barAttributes(const QModelIndex &index) const;
73 
74  void setThreeDBarAttributes(const ThreeDBarAttributes &a);
75  void setThreeDBarAttributes(int column, const ThreeDBarAttributes &a);
76  void setThreeDBarAttributes(const QModelIndex &index,
77  const ThreeDBarAttributes &a);
78  ThreeDBarAttributes threeDBarAttributes() const;
79  ThreeDBarAttributes threeDBarAttributes(int column) const;
80  ThreeDBarAttributes threeDBarAttributes(const QModelIndex &index) const;
81 
82 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined(Q_COMPILER_MANGLES_RETURN_TYPE)
83  // implement AbstractCartesianDiagram
85  const int numberOfAbscissaSegments() const;
87  const int numberOfOrdinateSegments() const;
88 #else
89  // implement AbstractCartesianDiagram
91  int numberOfAbscissaSegments() const override;
93  int numberOfOrdinateSegments() const override;
94 #endif
95 
96 protected:
97  void paint(PaintContext *paintContext) override;
98 
99 public:
100  void resize(const QSizeF &area) override;
101 
102 protected:
103  qreal threeDItemDepth(const QModelIndex &index) const override;
104  qreal threeDItemDepth(int column) const override;
106  const QPair<QPointF, QPointF> calculateDataBoundaries() const override;
107  void paintEvent(QPaintEvent *) override;
108  void resizeEvent(QResizeEvent *) override;
109 
110 private:
111  void calculateValueAndGapWidths(int rowCount, int colCount,
112  qreal groupWidth,
113  qreal &barWidth,
114  qreal &spaceBetweenBars,
115  qreal &spaceBetweenGroups);
116 }; // End of class BarDiagram
117 }
118 
119 #endif // KDCHARTBARDIAGRAM_H
#define KDCHART_DECLARE_DERIVED_DIAGRAM(X, PLANE)
Base class for diagrams based on a cartesian coordianate system.
Set of attributes for changing the appearance of bar charts.
BarDiagram defines a common bar diagram.
Stores information about painting diagrams.

© 2001 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/
Generated by doxygen 1.9.1