KChart

KChartLineAttributes.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 "KChartLineAttributes.h"
10
11#include "KChartMath_p.h"
12
13#include <QDebug>
14
15#define d d_func()
16
17using namespace KChart;
18
19class Q_DECL_HIDDEN LineAttributes::Private
20{
21 friend class LineAttributes;
22public:
23 Private();
24
25private:
26 //Areas
27 MissingValuesPolicy missingValuesPolicy;
28 bool displayArea;
29 bool visible;
30 uint transparency;
31 int areaBoundingDataset;
32};
33
34
35LineAttributes::Private::Private()
36 : missingValuesPolicy( MissingValuesAreBridged )
37 , displayArea( false )
38 , visible( true )
39 , transparency( 255 )
40 , areaBoundingDataset( -1 )
41{
42}
43
44
45LineAttributes::LineAttributes()
46 : _d( new Private() )
47{
48}
49
50LineAttributes::LineAttributes( const LineAttributes& r )
51 : _d( new Private( *r.d ) )
52{
53}
54
55LineAttributes& LineAttributes::operator= ( const LineAttributes& r )
56{
57 if ( this == &r )
58 return *this;
59
60 *d = *r.d;
61
62 return *this;
63}
64
65LineAttributes::~LineAttributes()
66{
67 delete _d; _d = nullptr;
68}
69
70bool LineAttributes::operator==( const LineAttributes& r ) const
71{
72 return
73 missingValuesPolicy() == r.missingValuesPolicy() &&
74 displayArea() == r.displayArea() &&
75 isVisible() == r.isVisible() &&
76 transparency() == r.transparency() &&
77 areaBoundingDataset() == r.areaBoundingDataset();
78}
79
80void LineAttributes::setMissingValuesPolicy( MissingValuesPolicy policy )
81{
82 d->missingValuesPolicy = policy;
83}
84
85LineAttributes::MissingValuesPolicy LineAttributes::missingValuesPolicy() const
86{
87 return d->missingValuesPolicy;
88}
89
90void LineAttributes::setDisplayArea( bool display )
91{
92 d->displayArea = display;
93}
94
95bool LineAttributes::displayArea() const
96{
97 return d->displayArea;
98}
99
100void LineAttributes::setTransparency( uint alpha )
101{
102 if ( alpha > 255 )
103 alpha = 255;
104 d->transparency = alpha;
105}
106
107uint LineAttributes::transparency() const
108{
109 return d->transparency;
110}
111
113{
114 d->areaBoundingDataset = dataset;
115}
116
117int LineAttributes::areaBoundingDataset() const
118{
119 return d->areaBoundingDataset;
120}
121
122void LineAttributes::setVisible( bool visible )
123{
124 d->visible = visible;
125}
126
127bool LineAttributes::isVisible() const
128{
129 return d->visible;
130}
131
132#if !defined(QT_NO_DEBUG_STREAM)
133QDebug operator<<(QDebug dbg, const KChart::LineAttributes& a)
134{
135 dbg << "KChart::LineAttributes("
136 // MissingValuesPolicy missingValuesPolicy;
137 << "bool="<<a.displayArea()
138 << "visible="<<a.isVisible()
139 << "transparency="<<a.transparency()
140 << "areaBoundingDataset="<<a.areaBoundingDataset()
141 << ")";
142 return dbg;
143
144}
145#endif /* QT_NO_DEBUG_STREAM */
Set of attributes for changing the appearance of line charts.
void setVisible(bool visible)
Determines if lines are to be drawn or not.
MissingValuesPolicy
MissingValuesPolicy specifies how a missing value will be shown in a line diagram.
void setAreaBoundingDataset(int dataset)
Sets the lower or upper (depending on the displayed value being positive or negative,...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:57:24 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.