1 | // Copyright (C) 2021 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | // W A R N I N G |
5 | // ------------- |
6 | // |
7 | // This file is not part of the Qt Chart API. It exists purely as an |
8 | // implementation detail. This header file may change from version to |
9 | // version without notice, or even be removed. |
10 | // |
11 | // We mean it. |
12 | |
13 | #ifndef CHARTDATASET_P_H |
14 | #define CHARTDATASET_P_H |
15 | |
16 | #include <QtCharts/QAbstractSeries> |
17 | #include <private/abstractdomain_p.h> |
18 | #include <private/qabstractaxis_p.h> |
19 | #include <QtCharts/private/qchartglobal_p.h> |
20 | #include <QtCore/QList> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | class QAbstractAxis; |
25 | class ChartPresenter; |
26 | class GLXYSeriesDataManager; |
27 | |
28 | class Q_CHARTS_PRIVATE_EXPORT ChartDataSet : public QObject |
29 | { |
30 | Q_OBJECT |
31 | public: |
32 | ChartDataSet(QChart *chart); |
33 | virtual ~ChartDataSet(); |
34 | |
35 | void addSeries(QAbstractSeries *series); |
36 | void removeSeries(QAbstractSeries *series); |
37 | QList<QAbstractSeries *> series() const; |
38 | |
39 | void addAxis(QAbstractAxis *axis,Qt::Alignment alignment); |
40 | void removeAxis(QAbstractAxis *axis); |
41 | QList<QAbstractAxis*> axes() const; |
42 | |
43 | bool attachAxis(QAbstractSeries* series,QAbstractAxis *axis); |
44 | bool detachAxis(QAbstractSeries* series,QAbstractAxis *axis); |
45 | |
46 | void createDefaultAxes(); |
47 | |
48 | void zoomInDomain(const QRectF &rect); |
49 | void zoomOutDomain(const QRectF &rect); |
50 | void zoomResetDomain(); |
51 | bool isZoomedDomain(); |
52 | void scrollDomain(qreal dx, qreal dy); |
53 | |
54 | QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0); |
55 | QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0); |
56 | |
57 | GLXYSeriesDataManager *glXYSeriesDataManager() { return m_glXYSeriesDataManager; } |
58 | |
59 | AbstractDomain* createDomain(AbstractDomain::DomainType type); |
60 | AbstractDomain* domainForSeries(QAbstractSeries *series) const; |
61 | |
62 | Q_SIGNALS: |
63 | void axisAdded(QAbstractAxis* axis); |
64 | void axisRemoved(QAbstractAxis* axis); |
65 | void seriesAdded(QAbstractSeries* series); |
66 | void seriesRemoved(QAbstractSeries* series); |
67 | public Q_SLOTS: |
68 | void reverseChanged(); |
69 | private: |
70 | void createAxes(QAbstractAxis::AxisTypes type, Qt::Orientation orientation); |
71 | QAbstractAxis *createAxis(QAbstractAxis::AxisType type, Qt::Orientation orientation); |
72 | AbstractDomain::DomainType selectDomain(const QList<QAbstractAxis *> &axes); |
73 | void deleteAllAxes(); |
74 | void deleteAllSeries(); |
75 | void findMinMaxForSeries(const QList<QAbstractSeries *> &series, Qt::Orientations orientation, |
76 | qreal &min, qreal &max); |
77 | |
78 | private: |
79 | QList<QAbstractSeries *> m_seriesList; |
80 | QList<QAbstractAxis *> m_axisList; |
81 | QChart* m_chart; |
82 | GLXYSeriesDataManager *m_glXYSeriesDataManager; |
83 | }; |
84 | |
85 | QT_END_NAMESPACE |
86 | |
87 | #endif /* CHARTENGINE_P_H */ |
88 | |