1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Charts module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29
30#ifndef QVALUEAXIS_H
31#define QVALUEAXIS_H
32
33#include <QtCharts/QAbstractAxis>
34
35QT_CHARTS_BEGIN_NAMESPACE
36
37class QValueAxisPrivate;
38
39class Q_CHARTS_EXPORT QValueAxis : public QAbstractAxis
40{
41 Q_OBJECT
42 Q_PROPERTY(int tickCount READ tickCount WRITE setTickCount NOTIFY tickCountChanged)
43 Q_PROPERTY(qreal min READ min WRITE setMin NOTIFY minChanged)
44 Q_PROPERTY(qreal max READ max WRITE setMax NOTIFY maxChanged)
45 Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged)
46 Q_PROPERTY(int minorTickCount READ minorTickCount WRITE setMinorTickCount NOTIFY minorTickCountChanged)
47 Q_PROPERTY(qreal tickAnchor READ tickAnchor WRITE setTickAnchor NOTIFY tickAnchorChanged REVISION 1)
48 Q_PROPERTY(qreal tickInterval READ tickInterval WRITE setTickInterval NOTIFY tickIntervalChanged REVISION 1)
49 Q_PROPERTY(TickType tickType READ tickType WRITE setTickType NOTIFY tickTypeChanged REVISION 1)
50 Q_ENUMS(TickType)
51
52public:
53 enum TickType {
54 TicksDynamic = 0,
55 TicksFixed
56 };
57
58public:
59 explicit QValueAxis(QObject *parent = nullptr);
60 ~QValueAxis();
61
62protected:
63 QValueAxis(QValueAxisPrivate &d, QObject *parent = nullptr);
64
65public:
66 AxisType type() const;
67
68 //range handling
69 void setMin(qreal min);
70 qreal min() const;
71 void setMax(qreal max);
72 qreal max() const;
73 void setRange(qreal min, qreal max);
74
75 //ticks handling
76 void setTickCount(int count);
77 int tickCount() const;
78 void setMinorTickCount(int count);
79 int minorTickCount() const;
80 void setTickAnchor(qreal anchor);
81 qreal tickAnchor() const;
82 void setTickInterval(qreal insterval);
83 qreal tickInterval() const;
84 void setTickType(QValueAxis::TickType type);
85 QValueAxis::TickType tickType() const;
86
87 void setLabelFormat(const QString &format);
88 QString labelFormat() const;
89
90public Q_SLOTS:
91 void applyNiceNumbers();
92
93Q_SIGNALS:
94 void minChanged(qreal min);
95 void maxChanged(qreal max);
96 void rangeChanged(qreal min, qreal max);
97 void tickCountChanged(int tickCount);
98 void minorTickCountChanged(int tickCount);
99 void labelFormatChanged(const QString &format);
100 Q_REVISION(1) void tickIntervalChanged(qreal interval);
101 Q_REVISION(1) void tickAnchorChanged(qreal anchor);
102 Q_REVISION(1) void tickTypeChanged(QValueAxis::TickType type);
103
104private:
105 Q_DECLARE_PRIVATE(QValueAxis)
106 Q_DISABLE_COPY(QValueAxis)
107};
108
109QT_CHARTS_END_NAMESPACE
110
111#endif // QVALUEAXIS_H
112

source code of qtcharts/src/charts/axis/valueaxis/qvalueaxis.h