1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QVALUEAXIS_H |
5 | #define QVALUEAXIS_H |
6 | |
7 | #include <QtCharts/QAbstractAxis> |
8 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | class QValueAxisPrivate; |
12 | |
13 | class Q_CHARTS_EXPORT QValueAxis : public QAbstractAxis |
14 | { |
15 | Q_OBJECT |
16 | Q_PROPERTY(int tickCount READ tickCount WRITE setTickCount NOTIFY tickCountChanged) |
17 | Q_PROPERTY(qreal min READ min WRITE setMin NOTIFY minChanged) |
18 | Q_PROPERTY(qreal max READ max WRITE setMax NOTIFY maxChanged) |
19 | Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged) |
20 | Q_PROPERTY(int minorTickCount READ minorTickCount WRITE setMinorTickCount NOTIFY minorTickCountChanged) |
21 | Q_PROPERTY(qreal tickAnchor READ tickAnchor WRITE setTickAnchor NOTIFY tickAnchorChanged |
22 | REVISION(2, 3)) |
23 | Q_PROPERTY(qreal tickInterval READ tickInterval WRITE setTickInterval NOTIFY tickIntervalChanged |
24 | REVISION(2, 3)) |
25 | Q_PROPERTY(TickType tickType READ tickType WRITE setTickType NOTIFY tickTypeChanged REVISION(2, |
26 | 3)) |
27 | Q_ENUMS(TickType) |
28 | |
29 | public: |
30 | enum TickType { |
31 | TicksDynamic = 0, |
32 | TicksFixed |
33 | }; |
34 | |
35 | public: |
36 | explicit QValueAxis(QObject *parent = nullptr); |
37 | ~QValueAxis(); |
38 | |
39 | protected: |
40 | QValueAxis(QValueAxisPrivate &d, QObject *parent = nullptr); |
41 | |
42 | public: |
43 | AxisType type() const override; |
44 | |
45 | //range handling |
46 | void setMin(qreal min); |
47 | qreal min() const; |
48 | void setMax(qreal max); |
49 | qreal max() const; |
50 | void setRange(qreal min, qreal max); |
51 | |
52 | //ticks handling |
53 | void setTickCount(int count); |
54 | int tickCount() const; |
55 | void setMinorTickCount(int count); |
56 | int minorTickCount() const; |
57 | void setTickAnchor(qreal anchor); |
58 | qreal tickAnchor() const; |
59 | void setTickInterval(qreal insterval); |
60 | qreal tickInterval() const; |
61 | void setTickType(QValueAxis::TickType type); |
62 | QValueAxis::TickType tickType() const; |
63 | |
64 | void setLabelFormat(const QString &format); |
65 | QString labelFormat() const; |
66 | |
67 | public Q_SLOTS: |
68 | void applyNiceNumbers(); |
69 | |
70 | Q_SIGNALS: |
71 | void minChanged(qreal min); |
72 | void maxChanged(qreal max); |
73 | void rangeChanged(qreal min, qreal max); |
74 | void tickCountChanged(int tickCount); |
75 | void minorTickCountChanged(int tickCount); |
76 | void labelFormatChanged(const QString &format); |
77 | Q_REVISION(2, 3) void tickIntervalChanged(qreal interval); |
78 | Q_REVISION(2, 3) void tickAnchorChanged(qreal anchor); |
79 | Q_REVISION(2, 3) void tickTypeChanged(QValueAxis::TickType type); |
80 | |
81 | private: |
82 | Q_DECLARE_PRIVATE(QValueAxis) |
83 | Q_DISABLE_COPY(QValueAxis) |
84 | }; |
85 | |
86 | QT_END_NAMESPACE |
87 | |
88 | #endif // QVALUEAXIS_H |
89 | |