KD Chart 2
[rev.2.7]
src
KDChart
Cartesian
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
26
#include "
KDChartAbstractCartesianDiagram.h
"
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
48
KDCHART_DECLARE_DERIVED_DIAGRAM
(
BarDiagram
,
CartesianCoordinatePlane
)
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
,
65
Stacked
,
66
Percent
,
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
QWidget
Class only listed here to document inheritance of some KDChart classes.
KDChart::BarDiagram::Percent
@ Percent
Definition:
KDChartBarDiagram.h:66
KDChart
Definition:
KDChartAbstractCartesianDiagram.h:30
KDChart::PaintContext
Stores information about painting diagrams.
Definition:
KDChartPaintContext.h:42
KDChart::BarDiagram::Stacked
@ Stacked
Definition:
KDChartBarDiagram.h:65
KDCHART_DECLARE_DERIVED_DIAGRAM
#define KDCHART_DECLARE_DERIVED_DIAGRAM(X, PLANE)
Definition:
KDChartGlobal.h:113
KDChart::BarDiagram::Normal
@ Normal
Definition:
KDChartBarDiagram.h:64
KDChart::AbstractCartesianDiagram
Base class for diagrams based on a cartesian coordianate system.
Definition:
KDChartAbstractCartesianDiagram.h:42
KDChartAbstractCartesianDiagram.h
KDChart::BarAttributes
Set of attributes for changing the appearance of bar charts.
Definition:
KDChartBarAttributes.h:35
KDChart::BarDiagram::BarType
BarType
Definition:
KDChartBarDiagram.h:64
KDChart::ThreeDBarAttributes
A set of 3D bar attributes.
Definition:
KDChartThreeDBarAttributes.h:36
QPair
Definition:
KDChartWidget.h:35
KDChartBarAttributes.h
KDChart::CartesianCoordinatePlane
Cartesian coordinate plane.
Definition:
KDChartCartesianCoordinatePlane.h:40
KDChart::BarDiagram
BarDiagram defines a common bar diagram.
Definition:
KDChartBarDiagram.h:43
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/