KChart

KChartCartesianAxis.h
1 /*
2  * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3  *
4  * This file is part of the KD Chart library.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef KCHARTCARTESIANAXIS_H
21 #define KCHARTCARTESIANAXIS_H
22 
23 #include <QList>
24 
25 #include "KChartAbstractAxis.h"
26 
27 namespace KChart {
28 
29  class AbstractCartesianDiagram;
30 
39  class KCHART_EXPORT CartesianAxis : public AbstractAxis
40  {
41  Q_OBJECT
42 
43  Q_DISABLE_COPY( CartesianAxis )
44  KCHART_DECLARE_PRIVATE_DERIVED_PARENT( CartesianAxis, AbstractDiagram* )
45 
46  Q_ENUMS(Position)
47 
48  public:
49  enum Position {
50  Bottom,
51  Top,
52  Right,
53  Left
54  };
55 
66  explicit CartesianAxis ( AbstractCartesianDiagram* diagram = nullptr );
67  ~CartesianAxis();
68 
72  bool compare( const CartesianAxis* other ) const;
73 
75  void paint( QPainter* ) override;
77  void paintCtx( PaintContext* ) override;
78 
82  void setTitleText( const QString& text );
83  QString titleText() const;
84 
91  void setTitleSpace( qreal value );
93  qreal titleSpace() const;
94 
96  void setTitleSize(qreal value);
98  qreal titleSize() const;
99 
100  void setTitleTextAttributes( const TextAttributes &a );
108  TextAttributes titleTextAttributes() const;
115  void resetTitleTextAttributes();
116  bool hasDefaultTitleTextAttributes() const;
117 
118  virtual void setPosition ( Position p );
119 #if defined(Q_COMPILER_MANGLES_RETURN_TYPE)
120  virtual const Position position () const;
121 #else
122  virtual Position position () const;
123 #endif
124 
125  virtual void layoutPlanes();
126 
127  virtual bool isAbscissa() const;
128  virtual bool isOrdinate() const;
129 
137  void setAnnotations( const QMap< qreal, QString >& annotations );
141  QMap< qreal, QString > annotations() const;
142 
147  void setCustomTicks( const QList< qreal >& ticksPostions );
151  QList< qreal > customTicks() const;
152 
156  void setCustomTickLength(int value);
160  int customTickLength() const;
161 
163  bool isEmpty() const override;
165  Qt::Orientations expandingDirections() const override;
167  QSize maximumSize() const override;
169  QSize minimumSize() const override;
171  QSize sizeHint() const override;
173  void setGeometry( const QRect& r ) override;
175  QRect geometry() const override;
176 
177  public Q_SLOTS:
178  void setCachedSizeDirty() const;
179 
180  virtual int tickLength( bool subUnitTicks = false ) const;
181  private Q_SLOTS:
182  void coordinateSystemChanged();
183  };
184 
186 }
187 
188 #if !defined(QT_NO_DEBUG_STREAM)
189 KCHART_EXPORT QDebug operator<<(QDebug dbg, KChart::CartesianAxis::Position pos);
190 #endif
191 
192 #endif
AbstractDiagram defines the interface for diagram classes.
Left
The class for cartesian axes.
Stores information about painting diagrams.
Base class for diagrams based on a cartesian coordianate system.
The base class for axes.
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
Top
A set of text attributes.
typedef Orientations
Global namespace.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Sep 23 2020 22:36:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.