1
/* This file is part of the KDE project
3
Copyright 2007-2008 Johannes Simon <johannes.simon@gmail.com>
4
Copyright (C) 2010 Carlos Licea <carlos@kdab.com>
5
Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6
Contact: Suresh Chande suresh.chande@nokia.com
8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Library General Public
10
License as published by the Free Software Foundation; either
11
version 2 of the License, or (at your option) any later version.
13
This library is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
Library General Public License for more details.
18
You should have received a copy of the GNU Library General Public License
19
along with this library; see the file COPYING.LIB. If not, write to
20
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
* Boston, MA 02110-1301, USA.
25
#ifndef KCHART_DATASET_H
26
#define KCHART_DATASET_H
33
#include <KDChartPieAttributes>
36
#include "ChartShape.h"
37
#include "CellRegion.h"
39
class KoShapeLoadingContext;
47
* @brief The DataSet class stores properties of a single data series.
49
* A global chart type can be overridden by setting a specific type
52
* To change properties of a single data point inside a data series,
53
* use section's like for example \a brush( int section ) where the
54
* section refers to the data-point number.
57
class CHARTSHAPELIB_EXPORT DataSet
60
DataSet( ChartProxyModel *model );
64
QString title() const;
65
ChartType chartType() const;
66
ChartSubtype chartSubType() const;
67
Axis *attachedAxis() const;
69
ChartProxyModel *model() const;
71
bool showValues() const;
72
bool showLabels() const;
74
// Graphics properties for the visualization of this dataset.
77
KDChart::PieAttributes pieAttributes() const;
78
QPen pen( int section ) const;
79
QBrush brush( int section ) const;
80
KDChart::PieAttributes pieAttributes( int section ) const;
84
bool showMeanValue() const;
85
QPen meanValuePen() const;
87
bool showLowerErrorIndicator() const;
88
bool showUpperErrorIndicator() const;
89
QPen errorIndicatorPen() const;
90
ErrorCategory errorCategory() const;
91
qreal errorPercentage() const;
92
qreal errorMargin() const;
93
qreal lowerErrorLimit() const;
94
qreal upperErrorLimit() const;
97
void setChartType( ChartType type );
98
void setChartSubType( ChartSubtype type );
99
void setAttachedAxis( Axis *axis );
101
void setShowValues( bool showValues );
102
void setShowLabels( bool showLabels );
104
void setPen( const QPen &pen );
105
void setBrush( const QBrush &brush );
106
void setPen( int section, const QPen &pen );
107
void setBrush( int section, const QBrush &brush );
108
void setColor( const QColor &color );
109
void setNumber( int num );
111
void setPieExplodeFactor( int factor );
112
void setPieExplodeFactor( int section, int factor );
114
void setShowMeanValue( bool b );
115
void setMeanValuePen( const QPen &pen );
117
void setShowLowerErrorIndicator( bool b );
118
void setShowUpperErrorIndicator( bool b );
119
void setShowErrorIndicators( bool lower, bool upper );
120
void setErrorIndicatorPen( const QPen &pen );
121
void setErrorCategory( ErrorCategory category );
122
void setErrorPercentage( qreal percentage );
123
void setErrorMargin( qreal margin );
124
void setLowerErrorLimit( qreal limit );
125
void setUpperErrorLimit( qreal limit );
127
QVariant xData( int index ) const;
128
QVariant yData( int index ) const;
129
QVariant customData( int index ) const;
130
QVariant categoryData( int index ) const;
131
QVariant labelData() const;
133
CellRegion xDataRegion() const;
134
CellRegion yDataRegion() const;
135
CellRegion customDataRegion() const;
136
CellRegion categoryDataRegion() const;
137
CellRegion labelDataRegion() const;
138
// TODO: Region for custom colors
140
QString xDataRegionString() const;
141
QString yDataRegionString() const;
142
QString customDataRegionString() const;
143
QString categoryDataRegionString() const;
144
QString labelDataRegionString() const;
146
void setXDataRegion( const CellRegion ®ion );
147
void setYDataRegion( const CellRegion ®ion );
148
void setCustomDataRegion( const CellRegion ®ion );
149
void setCategoryDataRegion( const CellRegion ®ion );
150
void setLabelDataRegion( const CellRegion ®ion );
152
void setXDataRegionString( const QString ®ion );
153
void setYDataRegionString( const QString ®ion );
154
void setCustomDataRegionString( const QString ®ion );
155
void setCategoryDataRegionString( const QString ®ion );
156
void setLabelDataRegionString( const QString ®ion );
159
int dimension() const;
161
void setKdDiagram( KDChart::AbstractDiagram *diagram );
162
void setKdDataSetNumber( int number );
164
KDChart::AbstractDiagram *kdDiagram() const;
165
int kdDataSetNumber() const;
167
// Called by the proxy model
168
void yDataChanged( int start, int end ) const;
169
void xDataChanged( int start, int end ) const;
170
void customDataChanged( int start, int end ) const;
171
void labelDataChanged() const;
172
void categoryDataChanged( int start, int end ) const;
174
void yDataChanged( const QRect ®ion ) const;
175
void xDataChanged( const QRect ®ion ) const;
176
void customDataChanged( const QRect ®ion ) const;
177
void labelDataChanged( const QRect ®ion ) const;
178
void categoryDataChanged( const QRect ®ion ) const;
180
void setKdChartModel( KDChartModel *model );
181
KDChartModel *kdChartModel() const;
183
void blockSignals( bool block );
185
bool loadOdf( const KoXmlElement &n,
186
KoShapeLoadingContext &context );
188
* Saves a series to ODF. Creates a new chart:series element.
190
void saveOdf( KoShapeSavingContext &context ) const;
197
} // Namespace KChart
199
#endif // KCHART_DATASET_H