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 QABSTRACTSERIES_H |
31 | #define QABSTRACTSERIES_H |
32 | |
33 | #include <QtCharts/QChartGlobal> |
34 | #include <QtCharts/QAbstractAxis> |
35 | #include <QtCore/QObject> |
36 | #include <QtGui/QPen> |
37 | |
38 | QT_CHARTS_BEGIN_NAMESPACE |
39 | |
40 | class QAbstractSeriesPrivate; |
41 | class QChart; |
42 | |
43 | class Q_CHARTS_EXPORT QAbstractSeries : public QObject |
44 | { |
45 | Q_OBJECT |
46 | Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) |
47 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) |
48 | Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) |
49 | Q_PROPERTY(SeriesType type READ type) |
50 | Q_PROPERTY(bool useOpenGL READ useOpenGL WRITE setUseOpenGL NOTIFY useOpenGLChanged) |
51 | Q_ENUMS(SeriesType) |
52 | |
53 | public: |
54 | enum SeriesType { |
55 | SeriesTypeLine, |
56 | SeriesTypeArea, |
57 | SeriesTypeBar, |
58 | SeriesTypeStackedBar, |
59 | SeriesTypePercentBar, |
60 | SeriesTypePie, |
61 | SeriesTypeScatter, |
62 | SeriesTypeSpline, |
63 | SeriesTypeHorizontalBar, |
64 | SeriesTypeHorizontalStackedBar, |
65 | SeriesTypeHorizontalPercentBar, |
66 | SeriesTypeBoxPlot, |
67 | SeriesTypeCandlestick |
68 | }; |
69 | |
70 | protected: |
71 | QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent = nullptr); |
72 | |
73 | public: |
74 | ~QAbstractSeries(); |
75 | virtual SeriesType type() const = 0; |
76 | |
77 | void setName(const QString &name); |
78 | QString name() const; |
79 | void setVisible(bool visible = true); |
80 | bool isVisible() const; |
81 | qreal opacity() const; |
82 | void setOpacity(qreal opacity); |
83 | void setUseOpenGL(bool enable = true); |
84 | bool useOpenGL() const; |
85 | |
86 | QChart *chart() const; |
87 | |
88 | bool attachAxis(QAbstractAxis *axis); |
89 | bool detachAxis(QAbstractAxis *axis); |
90 | QList<QAbstractAxis*> attachedAxes(); |
91 | |
92 | void show(); |
93 | void hide(); |
94 | |
95 | Q_SIGNALS: |
96 | void nameChanged(); |
97 | void visibleChanged(); |
98 | void opacityChanged(); |
99 | void useOpenGLChanged(); |
100 | |
101 | protected: |
102 | QScopedPointer<QAbstractSeriesPrivate> d_ptr; |
103 | friend class ChartDataSet; |
104 | friend class ChartPresenter; |
105 | friend class ChartThemeManager; |
106 | friend class QLegendPrivate; |
107 | friend class DeclarativeChart; |
108 | friend class QAreaSeries; |
109 | friend class GLWidget; |
110 | }; |
111 | |
112 | QT_CHARTS_END_NAMESPACE |
113 | |
114 | #endif // QABSTRACTSERIES_H |
115 | |