KChart

KChartBarAttributes.cpp
1/*
2 * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3 *
4 * This file is part of the KD Chart library.
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#include "KChartBarAttributes.h"
10
11#include "KChartMath_p.h"
12
13#include <qglobal.h>
14
15#define d d_func()
16
17
18using namespace KChart;
19
20class Q_DECL_HIDDEN BarAttributes::Private
21{
22 friend class BarAttributes;
23public:
24 Private();
25
26private:
27 qreal datasetGap;
28 bool useFixedDatasetGap;
29 qreal valueBlockGap;
30 bool useFixedValueBlockGap;
31 qreal barWidth;
32 bool useFixedBarWidth;
33 bool drawSolidExcessArrows;
34 qreal groupGapFactor;
35 qreal barGapFactor;
36};
37
38
39BarAttributes::Private::Private()
40 :datasetGap( 6 ),
41 useFixedDatasetGap( false ),
42 valueBlockGap( 24 ),
43 useFixedValueBlockGap( false ),
44 barWidth( -1 ),
45 useFixedBarWidth( false ),
46 drawSolidExcessArrows( false ),
47 groupGapFactor( 2.0 ),
48 barGapFactor( 0.4 )
49{
50}
51
52
53BarAttributes::BarAttributes()
54 : _d( new Private() )
55{
56}
57
58BarAttributes::BarAttributes( const BarAttributes& r )
59 : _d( new Private( *r.d ) )
60{
61}
62
63BarAttributes& BarAttributes::operator= ( const BarAttributes& r )
64{
65 if ( this == &r )
66 return *this;
67
68 *d = *r.d;
69
70 return *this;
71}
72
73BarAttributes::~BarAttributes()
74{
75 delete _d; _d = nullptr;
76}
77
78
79bool BarAttributes::operator==( const BarAttributes& r ) const
80{
81 if ( fixedDataValueGap() == r.fixedDataValueGap() &&
82 useFixedDataValueGap() == r.useFixedDataValueGap() &&
83 fixedValueBlockGap() == r.fixedValueBlockGap() &&
84 useFixedValueBlockGap() == r.useFixedValueBlockGap() &&
85 fixedBarWidth() == r.fixedBarWidth() &&
86 useFixedBarWidth() == r.useFixedBarWidth() &&
87 groupGapFactor() == r.groupGapFactor() &&
88 barGapFactor() == r.barGapFactor() &&
89 drawSolidExcessArrows() == r.drawSolidExcessArrows() )
90 return true;
91 else
92 return false;
93}
94
95
96void BarAttributes::setFixedDataValueGap( qreal gap )
97{
98 d->datasetGap = gap;
99}
100
101qreal BarAttributes::fixedDataValueGap() const
102{
103 return d->datasetGap;
104}
105
106void BarAttributes::setUseFixedDataValueGap( bool gapIsFixed )
107{
108 d->useFixedDatasetGap = gapIsFixed;
109}
110
111bool BarAttributes::useFixedDataValueGap() const
112{
113 return d->useFixedDatasetGap;
114}
115
116void BarAttributes::setFixedValueBlockGap( qreal gap )
117{
118 d->valueBlockGap = gap;
119}
120
121qreal BarAttributes::fixedValueBlockGap() const
122{
123 return d->valueBlockGap;
124}
125
126void BarAttributes::setUseFixedValueBlockGap( bool gapIsFixed )
127{
128 d->useFixedValueBlockGap = gapIsFixed;
129}
130
131bool BarAttributes::useFixedValueBlockGap() const
132{
133 return d->useFixedValueBlockGap;
134}
135
136void BarAttributes::setFixedBarWidth( qreal width )
137{
138 d->barWidth = width;
139}
140
141qreal BarAttributes::fixedBarWidth() const
142{
143
144 return d->barWidth;
145}
146
147void BarAttributes::setUseFixedBarWidth( bool useFixedBarWidth )
148{
149 d->useFixedBarWidth = useFixedBarWidth;
150}
151
152bool BarAttributes::useFixedBarWidth() const
153{
154 return d->useFixedBarWidth;
155}
156
157void BarAttributes::setGroupGapFactor( qreal gapFactor )
158{
159 d->groupGapFactor = gapFactor;
160}
161
162qreal BarAttributes::groupGapFactor() const
163{
164 return d->groupGapFactor;
165}
166
167void BarAttributes::setBarGapFactor( qreal gapFactor )
168{
169 d->barGapFactor = gapFactor;
170}
171
172qreal BarAttributes::barGapFactor() const
173{
174 return d->barGapFactor;
175}
176
177void BarAttributes::setDrawSolidExcessArrows( bool solidArrows )
178{
179 d->drawSolidExcessArrows = solidArrows;
180}
181
182bool BarAttributes::drawSolidExcessArrows() const
183{
184 return d->drawSolidExcessArrows;
185}
186
Set of attributes for changing the appearance of bar charts.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:02:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.