@@ -1,99 +1,101 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2013 Digia Plc |
|
3 | ** Copyright (C) 2013 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | // W A R N I N G |
|
21 | // W A R N I N G | |
22 | // ------------- |
|
22 | // ------------- | |
23 | // |
|
23 | // | |
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
25 | // implementation detail. This header file may change from version to |
|
25 | // implementation detail. This header file may change from version to | |
26 | // version without notice, or even be removed. |
|
26 | // version without notice, or even be removed. | |
27 | // |
|
27 | // | |
28 | // We mean it. |
|
28 | // We mean it. | |
29 |
|
29 | |||
30 | #ifndef QABSTRACTSERIES_P_H |
|
30 | #ifndef QABSTRACTSERIES_P_H | |
31 | #define QABSTRACTSERIES_P_H |
|
31 | #define QABSTRACTSERIES_P_H | |
32 |
|
32 | |||
33 | #include "qabstractseries.h" |
|
33 | #include "qabstractseries.h" | |
34 | #include "qchart.h" |
|
34 | #include "qchart.h" | |
35 | #include "abstractdomain_p.h" |
|
35 | #include "abstractdomain_p.h" | |
36 |
|
36 | |||
37 | class QGraphicsItem; |
|
37 | class QGraphicsItem; | |
38 |
|
38 | |||
39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
40 |
|
40 | |||
41 | class ChartPresenter; |
|
41 | class ChartPresenter; | |
42 | class ChartElement; |
|
42 | class ChartElement; | |
43 | class LegendMarker; |
|
43 | class LegendMarker; | |
44 | class QLegend; |
|
44 | class QLegend; | |
45 | class ChartDataSet; |
|
45 | class ChartDataSet; | |
46 | class QAbstractAxis; |
|
46 | class QAbstractAxis; | |
47 | class QLegendMarker; |
|
47 | class QLegendMarker; | |
48 | class ChartTheme; |
|
48 | class ChartTheme; | |
49 | class ChartAnimation; |
|
49 | class ChartAnimation; | |
50 | class ChartItem; |
|
50 | class ChartItem; | |
|
51 | class BoxPlotChartItem; | |||
51 |
|
52 | |||
52 | class QAbstractSeriesPrivate : public QObject |
|
53 | class QAbstractSeriesPrivate : public QObject | |
53 | { |
|
54 | { | |
54 | Q_OBJECT |
|
55 | Q_OBJECT | |
55 | public: |
|
56 | public: | |
56 | QAbstractSeriesPrivate(QAbstractSeries *q); |
|
57 | QAbstractSeriesPrivate(QAbstractSeries *q); | |
57 | ~QAbstractSeriesPrivate(); |
|
58 | ~QAbstractSeriesPrivate(); | |
58 |
|
59 | |||
59 | virtual void initializeDomain() = 0; |
|
60 | virtual void initializeDomain() = 0; | |
60 | virtual void initializeAxes() = 0; |
|
61 | virtual void initializeAxes() = 0; | |
61 | virtual void initializeTheme(int index, ChartTheme* theme, bool forced = false) = 0; |
|
62 | virtual void initializeTheme(int index, ChartTheme* theme, bool forced = false) = 0; | |
62 | virtual void initializeGraphics(QGraphicsItem* parent) = 0; |
|
63 | virtual void initializeGraphics(QGraphicsItem* parent) = 0; | |
63 | virtual void initializeAnimations(QChart::AnimationOptions options) = 0; |
|
64 | virtual void initializeAnimations(QChart::AnimationOptions options) = 0; | |
64 |
|
65 | |||
65 | virtual QList<QLegendMarker*> createLegendMarkers(QLegend* legend) = 0; |
|
66 | virtual QList<QLegendMarker*> createLegendMarkers(QLegend* legend) = 0; | |
66 |
|
67 | |||
67 | virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation) const = 0; |
|
68 | virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation) const = 0; | |
68 | virtual QAbstractAxis* createDefaultAxis(Qt::Orientation) const = 0; |
|
69 | virtual QAbstractAxis* createDefaultAxis(Qt::Orientation) const = 0; | |
69 |
|
70 | |||
70 | ChartItem* chartItem() { return m_item.data(); } |
|
71 | ChartItem* chartItem() { return m_item.data(); } | |
71 |
|
72 | |||
72 | virtual void setDomain(AbstractDomain* domain); |
|
73 | virtual void setDomain(AbstractDomain* domain); | |
73 | AbstractDomain* domain() { return m_domain.data(); } |
|
74 | AbstractDomain* domain() { return m_domain.data(); } | |
74 |
|
75 | |||
75 | QChart* chart() { return m_chart; } |
|
76 | QChart* chart() { return m_chart; } | |
76 |
|
77 | |||
77 | Q_SIGNALS: |
|
78 | Q_SIGNALS: | |
78 | void countChanged(); |
|
79 | void countChanged(); | |
79 |
|
80 | |||
80 | protected: |
|
81 | protected: | |
|
82 | friend class BoxPlotChartItem; | |||
81 | QAbstractSeries *q_ptr; |
|
83 | QAbstractSeries *q_ptr; | |
82 | QChart *m_chart; |
|
84 | QChart *m_chart; | |
83 | QScopedPointer<ChartItem> m_item; |
|
85 | QScopedPointer<ChartItem> m_item; | |
84 | QList<QAbstractAxis*> m_axes; |
|
86 | QList<QAbstractAxis*> m_axes; | |
85 | private: |
|
87 | private: | |
86 | QScopedPointer<AbstractDomain> m_domain; |
|
88 | QScopedPointer<AbstractDomain> m_domain; | |
87 | QString m_name; |
|
89 | QString m_name; | |
88 | bool m_visible; |
|
90 | bool m_visible; | |
89 | qreal m_opacity; |
|
91 | qreal m_opacity; | |
90 |
|
92 | |||
91 | friend class QAbstractSeries; |
|
93 | friend class QAbstractSeries; | |
92 | friend class ChartDataSet; |
|
94 | friend class ChartDataSet; | |
93 | friend class ChartPresenter; |
|
95 | friend class ChartPresenter; | |
94 | friend class QLegendPrivate; |
|
96 | friend class QLegendPrivate; | |
95 | }; |
|
97 | }; | |
96 |
|
98 | |||
97 | QTCOMMERCIALCHART_END_NAMESPACE |
|
99 | QTCOMMERCIALCHART_END_NAMESPACE | |
98 |
|
100 | |||
99 | #endif |
|
101 | #endif |
@@ -1,151 +1,153 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2013 Digia Plc |
|
3 | ** Copyright (C) 2013 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef QCHART_H |
|
21 | #ifndef QCHART_H | |
22 | #define QCHART_H |
|
22 | #define QCHART_H | |
23 |
|
23 | |||
24 | #include <QAbstractSeries> |
|
24 | #include <QAbstractSeries> | |
25 | #include <QLegend> |
|
25 | #include <QLegend> | |
26 | #include <QGraphicsWidget> |
|
26 | #include <QGraphicsWidget> | |
27 | #include <QMargins> |
|
27 | #include <QMargins> | |
28 |
|
28 | |||
29 | class QGraphicsSceneResizeEvent; |
|
29 | class QGraphicsSceneResizeEvent; | |
30 |
|
30 | |||
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
32 |
|
32 | |||
33 | class QAbstractSeries; |
|
33 | class QAbstractSeries; | |
34 | class QAbstractAxis; |
|
34 | class QAbstractAxis; | |
35 | class QLegend; |
|
35 | class QLegend; | |
36 | class QChartPrivate; |
|
36 | class QChartPrivate; | |
|
37 | class QBoxPlotSeries; | |||
37 |
|
38 | |||
38 | class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsWidget |
|
39 | class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsWidget | |
39 | { |
|
40 | { | |
40 | Q_OBJECT |
|
41 | Q_OBJECT | |
41 | Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme) |
|
42 | Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme) | |
42 | Q_PROPERTY(QString title READ title WRITE setTitle) |
|
43 | Q_PROPERTY(QString title READ title WRITE setTitle) | |
43 | Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible) |
|
44 | Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible) | |
44 | Q_PROPERTY(bool dropShadowEnabled READ isDropShadowEnabled WRITE setDropShadowEnabled) |
|
45 | Q_PROPERTY(bool dropShadowEnabled READ isDropShadowEnabled WRITE setDropShadowEnabled) | |
45 | Q_PROPERTY(QChart::AnimationOptions animationOptions READ animationOptions WRITE setAnimationOptions) |
|
46 | Q_PROPERTY(QChart::AnimationOptions animationOptions READ animationOptions WRITE setAnimationOptions) | |
46 | Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins) |
|
47 | Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins) | |
47 | Q_PROPERTY(QMargins margins READ margins WRITE setMargins) |
|
48 | Q_PROPERTY(QMargins margins READ margins WRITE setMargins) | |
48 | Q_ENUMS(ChartTheme) |
|
49 | Q_ENUMS(ChartTheme) | |
49 | Q_ENUMS(AnimationOption) |
|
50 | Q_ENUMS(AnimationOption) | |
50 |
|
51 | |||
51 | public: |
|
52 | public: | |
52 | enum ChartTheme { |
|
53 | enum ChartTheme { | |
53 | ChartThemeLight = 0, |
|
54 | ChartThemeLight = 0, | |
54 | ChartThemeBlueCerulean, |
|
55 | ChartThemeBlueCerulean, | |
55 | ChartThemeDark, |
|
56 | ChartThemeDark, | |
56 | ChartThemeBrownSand, |
|
57 | ChartThemeBrownSand, | |
57 | ChartThemeBlueNcs, |
|
58 | ChartThemeBlueNcs, | |
58 | ChartThemeHighContrast, |
|
59 | ChartThemeHighContrast, | |
59 | ChartThemeBlueIcy |
|
60 | ChartThemeBlueIcy | |
60 | }; |
|
61 | }; | |
61 |
|
62 | |||
62 | enum AnimationOption { |
|
63 | enum AnimationOption { | |
63 | NoAnimation = 0x0, |
|
64 | NoAnimation = 0x0, | |
64 | GridAxisAnimations = 0x1, |
|
65 | GridAxisAnimations = 0x1, | |
65 | SeriesAnimations = 0x2, |
|
66 | SeriesAnimations = 0x2, | |
66 | AllAnimations = 0x3 |
|
67 | AllAnimations = 0x3 | |
67 | }; |
|
68 | }; | |
68 |
|
69 | |||
69 | Q_DECLARE_FLAGS(AnimationOptions, AnimationOption) |
|
70 | Q_DECLARE_FLAGS(AnimationOptions, AnimationOption) | |
70 |
|
71 | |||
71 | public: |
|
72 | public: | |
72 | explicit QChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); |
|
73 | explicit QChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); | |
73 | ~QChart(); |
|
74 | ~QChart(); | |
74 |
|
75 | |||
75 | void addSeries(QAbstractSeries *series); |
|
76 | void addSeries(QAbstractSeries *series); | |
76 | void removeSeries(QAbstractSeries *series); |
|
77 | void removeSeries(QAbstractSeries *series); | |
77 | void removeAllSeries(); |
|
78 | void removeAllSeries(); | |
78 | QList<QAbstractSeries *> series() const; |
|
79 | QList<QAbstractSeries *> series() const; | |
79 |
|
80 | |||
80 | // *** deprecated *** |
|
81 | // *** deprecated *** | |
81 | void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0); |
|
82 | void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0); | |
82 | void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0); |
|
83 | void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0); | |
83 | QAbstractAxis *axisX(QAbstractSeries *series = 0) const; |
|
84 | QAbstractAxis *axisX(QAbstractSeries *series = 0) const; | |
84 | QAbstractAxis *axisY(QAbstractSeries *series = 0) const; |
|
85 | QAbstractAxis *axisY(QAbstractSeries *series = 0) const; | |
85 | // ****************** |
|
86 | // ****************** | |
86 |
|
87 | |||
87 | void addAxis(QAbstractAxis *axis,Qt::Alignment alignment); |
|
88 | void addAxis(QAbstractAxis *axis,Qt::Alignment alignment); | |
88 | void removeAxis(QAbstractAxis *axis); |
|
89 | void removeAxis(QAbstractAxis *axis); | |
89 | QList<QAbstractAxis*> axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical, QAbstractSeries *series = 0) const; |
|
90 | QList<QAbstractAxis*> axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical, QAbstractSeries *series = 0) const; | |
90 |
|
91 | |||
91 | void createDefaultAxes(); |
|
92 | void createDefaultAxes(); | |
92 |
|
93 | |||
93 | void setTheme(QChart::ChartTheme theme); |
|
94 | void setTheme(QChart::ChartTheme theme); | |
94 | QChart::ChartTheme theme() const; |
|
95 | QChart::ChartTheme theme() const; | |
95 |
|
96 | |||
96 | void setTitle(const QString &title); |
|
97 | void setTitle(const QString &title); | |
97 | QString title() const; |
|
98 | QString title() const; | |
98 | void setTitleFont(const QFont &font); |
|
99 | void setTitleFont(const QFont &font); | |
99 | QFont titleFont() const; |
|
100 | QFont titleFont() const; | |
100 | void setTitleBrush(const QBrush &brush); |
|
101 | void setTitleBrush(const QBrush &brush); | |
101 | QBrush titleBrush() const; |
|
102 | QBrush titleBrush() const; | |
102 |
|
103 | |||
103 | void setBackgroundBrush(const QBrush &brush); |
|
104 | void setBackgroundBrush(const QBrush &brush); | |
104 | QBrush backgroundBrush() const; |
|
105 | QBrush backgroundBrush() const; | |
105 | void setBackgroundPen(const QPen &pen); |
|
106 | void setBackgroundPen(const QPen &pen); | |
106 | QPen backgroundPen() const; |
|
107 | QPen backgroundPen() const; | |
107 | void setBackgroundVisible(bool visible = true); |
|
108 | void setBackgroundVisible(bool visible = true); | |
108 | bool isBackgroundVisible() const; |
|
109 | bool isBackgroundVisible() const; | |
109 |
|
110 | |||
110 | void setDropShadowEnabled(bool enabled = true); |
|
111 | void setDropShadowEnabled(bool enabled = true); | |
111 | bool isDropShadowEnabled() const; |
|
112 | bool isDropShadowEnabled() const; | |
112 | void setAnimationOptions(AnimationOptions options); |
|
113 | void setAnimationOptions(AnimationOptions options); | |
113 | AnimationOptions animationOptions() const; |
|
114 | AnimationOptions animationOptions() const; | |
114 |
|
115 | |||
115 | void zoomIn(); |
|
116 | void zoomIn(); | |
116 | void zoomOut(); |
|
117 | void zoomOut(); | |
117 |
|
118 | |||
118 | void zoomIn(const QRectF &rect); |
|
119 | void zoomIn(const QRectF &rect); | |
119 | void zoom(qreal factor); |
|
120 | void zoom(qreal factor); | |
120 |
|
121 | |||
121 | void scroll(qreal dx, qreal dy); |
|
122 | void scroll(qreal dx, qreal dy); | |
122 |
|
123 | |||
123 | QLegend *legend() const; |
|
124 | QLegend *legend() const; | |
124 |
|
125 | |||
125 | void setMinimumMargins(const QMargins& margins); |
|
126 | void setMinimumMargins(const QMargins& margins); | |
126 | QMargins minimumMargins() const; |
|
127 | QMargins minimumMargins() const; | |
127 |
|
128 | |||
128 | void setMargins(const QMargins &margins); |
|
129 | void setMargins(const QMargins &margins); | |
129 | QMargins margins() const; |
|
130 | QMargins margins() const; | |
130 |
|
131 | |||
131 | QRectF plotArea() const; |
|
132 | QRectF plotArea() const; | |
132 |
|
133 | |||
133 | QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0); |
|
134 | QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0); | |
134 | QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0); |
|
135 | QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0); | |
135 |
|
136 | |||
136 | protected: |
|
137 | protected: | |
137 | QScopedPointer<QChartPrivate> d_ptr; |
|
138 | QScopedPointer<QChartPrivate> d_ptr; | |
138 | friend class QLegend; |
|
139 | friend class QLegend; | |
139 | friend class DeclarativeChart; |
|
140 | friend class DeclarativeChart; | |
140 | friend class ChartDataSet; |
|
141 | friend class ChartDataSet; | |
141 | friend class ChartPresenter; |
|
142 | friend class ChartPresenter; | |
142 | friend class ChartThemeManager; |
|
143 | friend class ChartThemeManager; | |
143 | friend class QAbstractSeries; |
|
144 | friend class QAbstractSeries; | |
|
145 | friend class QBoxPlotSeriesPrivate; | |||
144 | Q_DISABLE_COPY(QChart) |
|
146 | Q_DISABLE_COPY(QChart) | |
145 | }; |
|
147 | }; | |
146 |
|
148 | |||
147 | QTCOMMERCIALCHART_END_NAMESPACE |
|
149 | QTCOMMERCIALCHART_END_NAMESPACE | |
148 |
|
150 | |||
149 | Q_DECLARE_OPERATORS_FOR_FLAGS(QTCOMMERCIALCHART_NAMESPACE::QChart::AnimationOptions) |
|
151 | Q_DECLARE_OPERATORS_FOR_FLAGS(QTCOMMERCIALCHART_NAMESPACE::QChart::AnimationOptions) | |
150 |
|
152 | |||
151 | #endif // QCHART_H |
|
153 | #endif // QCHART_H |
General Comments 0
You need to be logged in to leave comments.
Login now