2
KDChart - a multi-platform charting engine
5
/****************************************************************************
6
** Copyright (C) 2005-2007 Klarälvdalens Datakonsult AB. All rights reserved.
8
** This file is part of the KD Chart library.
10
** This file may be used under the terms of the GNU General Public
11
** License versions 2.0 or 3.0 as published by the Free Software
12
** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
13
** included in the packaging of this file. Alternatively you may (at
14
** your option) use any later version of the GNU General Public
15
** License if such license has been publicly approved by
16
** Klarälvdalens Datakonsult AB (or its successors, if any).
18
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
19
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
20
** A PARTICULAR PURPOSE. Klarälvdalens Datakonsult AB reserves all rights
21
** not expressly granted herein.
23
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
24
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26
**********************************************************************/
27
#ifndef KDCHARTCARTESIANAXIS_H
28
#define KDCHARTCARTESIANAXIS_H
32
#include "KDChartAbstractAxis.h"
36
class AbstractCartesianDiagram;
39
* The class for cartesian axes.
41
* For being useful, axes need to be assigned to a diagram, see
42
* AbstractCartesianDiagram::addAxis and AbstractCartesianDiagram::takeAxis.
44
* \sa PolarAxis, AbstractCartesianDiagram
46
class KDCHART_EXPORT CartesianAxis : public AbstractAxis
50
Q_DISABLE_COPY( CartesianAxis )
51
KDCHART_DECLARE_PRIVATE_DERIVED_PARENT( CartesianAxis, AbstractDiagram* )
62
* C'tor of the class for cartesian axes.
64
* \note If using a zero parent for the constructor, you need to call
65
* your diagram's addAxis function to add your axis to the diagram.
66
* Otherwise, there is no need to call addAxis, since the constructor
67
* does that automatically for you, if you pass a diagram as parameter.
69
* \sa AbstractCartesianDiagram::addAxis
71
explicit CartesianAxis ( AbstractCartesianDiagram* diagram = 0 );
75
* Returns true if both axes have the same settings.
77
bool compare( const CartesianAxis* other )const;
80
virtual void paint( QPainter* );
82
virtual void paintCtx( PaintContext* );
84
void setTitleText( const QString& text );
85
QString titleText() const;
87
void setTitleTextAttributes( const TextAttributes &a );
89
* Returns the text attributes that will be used for displaying the
91
* This is either the text attributes as specified by setTitleTextAttributes,
92
* or (if setTitleTextAttributes() was not called) the default text attributes.
93
* \sa resetTitleTextAttributes, hasDefaultTitleTextAttributes
95
TextAttributes titleTextAttributes() const;
97
* Reset the title text attributes to the built-in default:
99
* Same font and pen as AbstractAxis::textAttributes()
100
* and 1.5 times their size.
102
void resetTitleTextAttributes();
103
bool hasDefaultTitleTextAttributes() const;
105
virtual void setPosition ( Position p );
106
#if QT_VERSION < 0x040400 || defined(Q_COMPILER_MANGLES_RETURN_TYPE)
107
virtual const Position position () const;
109
virtual Position position () const;
112
virtual void layoutPlanes();
114
virtual bool isAbscissa() const;
115
virtual bool isOrdinate() const;
118
* Sets the axis annotations to \a annotations.
119
* Annotations are a QMap of doubles and QStrings defining special
120
* markers and their position.
121
* If you use annotations, the normal ticks and values will be invisible.
122
* To unset the annotations, pass an empty QMap.
124
void setAnnotations( const QMap< double, QString >& annotations );
126
* Returns the currently set axis annotations.
128
QMap< double, QString > annotations() const;
130
/** pure virtual in QLayoutItem */
131
virtual bool isEmpty() const;
132
/** pure virtual in QLayoutItem */
133
virtual Qt::Orientations expandingDirections() const;
134
/** pure virtual in QLayoutItem */
135
virtual QSize maximumSize() const;
136
/** pure virtual in QLayoutItem */
137
virtual QSize minimumSize() const;
138
/** pure virtual in QLayoutItem */
139
virtual QSize sizeHint() const;
140
/** pure virtual in QLayoutItem */
141
virtual void setGeometry( const QRect& r );
142
/** pure virtual in QLayoutItem */
143
virtual QRect geometry() const;
146
void setCachedSizeDirty() const;
149
int tickLength( bool subUnitTicks = false ) const;
152
typedef QList<CartesianAxis*> CartesianAxisList;