@@ -1,194 +1,193 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 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 QABSTRACTAXIS_H |
|
21 | #ifndef QABSTRACTAXIS_H | |
22 | #define QABSTRACTAXIS_H |
|
22 | #define QABSTRACTAXIS_H | |
23 |
|
23 | |||
24 | #include <qchartglobal.h> |
|
24 | #include <qchartglobal.h> | |
25 | #include <QPen> |
|
25 | #include <QPen> | |
26 | #include <QFont> |
|
26 | #include <QFont> | |
27 | #include <QVariant> |
|
27 | #include <QVariant> | |
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
30 | |||
31 | class QAbstractAxisPrivate; |
|
31 | class QAbstractAxisPrivate; | |
32 |
|
32 | |||
33 | class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject |
|
33 | class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject | |
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | //visibility |
|
36 | //visibility | |
37 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) |
|
37 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) | |
38 | //arrow |
|
38 | //arrow | |
39 | Q_PROPERTY(bool lineVisible READ isLineVisible WRITE setLineVisible NOTIFY lineVisibleChanged) |
|
39 | Q_PROPERTY(bool lineVisible READ isLineVisible WRITE setLineVisible NOTIFY lineVisibleChanged) | |
40 | Q_PROPERTY(QPen linePen READ linePen WRITE setLinePen NOTIFY linePenChanged) |
|
40 | Q_PROPERTY(QPen linePen READ linePen WRITE setLinePen NOTIFY linePenChanged) | |
41 | Q_PROPERTY(QColor color READ linePenColor WRITE setLinePenColor NOTIFY colorChanged) |
|
41 | Q_PROPERTY(QColor color READ linePenColor WRITE setLinePenColor NOTIFY colorChanged) | |
42 | //labels |
|
42 | //labels | |
43 | Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged) |
|
43 | Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged) | |
44 | Q_PROPERTY(QPen labelsPen READ labelsPen WRITE setLabelsPen NOTIFY labelsPenChanged) |
|
44 | Q_PROPERTY(QPen labelsPen READ labelsPen WRITE setLabelsPen NOTIFY labelsPenChanged) | |
45 | Q_PROPERTY(QBrush labelsBrush READ labelsBrush WRITE setLabelsBrush NOTIFY labelsBrushChanged) |
|
45 | Q_PROPERTY(QBrush labelsBrush READ labelsBrush WRITE setLabelsBrush NOTIFY labelsBrushChanged) | |
46 | //TODO: fix labels angles to work with layout |
|
46 | //TODO: fix labels angles to work with layout | |
47 | Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle NOTIFY labelsAngleChanged) |
|
47 | Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle NOTIFY labelsAngleChanged) | |
48 | Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont NOTIFY labelsFontChanged) |
|
48 | Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont NOTIFY labelsFontChanged) | |
49 | Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged) |
|
49 | Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged) | |
50 | //grid |
|
50 | //grid | |
51 | Q_PROPERTY(bool gridVisible READ isGridLineVisible WRITE setGridLineVisible NOTIFY gridVisibleChanged) |
|
51 | Q_PROPERTY(bool gridVisible READ isGridLineVisible WRITE setGridLineVisible NOTIFY gridVisibleChanged) | |
52 | Q_PROPERTY(QPen gridLinePen READ gridLinePen WRITE setGridLinePen NOTIFY gridLinePenChanged) |
|
52 | Q_PROPERTY(QPen gridLinePen READ gridLinePen WRITE setGridLinePen NOTIFY gridLinePenChanged) | |
53 | //shades |
|
53 | //shades | |
54 | Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged) |
|
54 | Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged) | |
55 | Q_PROPERTY(QColor shadesColor READ shadesColor WRITE setShadesColor NOTIFY shadesColorChanged) |
|
55 | Q_PROPERTY(QColor shadesColor READ shadesColor WRITE setShadesColor NOTIFY shadesColorChanged) | |
56 | //TODO: make wrapping of border for qml |
|
|||
57 | Q_PROPERTY(QColor shadesBorderColor READ shadesBorderColor WRITE setShadesBorderColor NOTIFY shadesBorderColorChanged) |
|
56 | Q_PROPERTY(QColor shadesBorderColor READ shadesBorderColor WRITE setShadesBorderColor NOTIFY shadesBorderColorChanged) | |
58 | Q_PROPERTY(QPen shadesPen READ shadesPen WRITE setShadesPen NOTIFY shadesPenChanged) |
|
57 | Q_PROPERTY(QPen shadesPen READ shadesPen WRITE setShadesPen NOTIFY shadesPenChanged) | |
59 | Q_PROPERTY(QBrush shadesBrush READ shadesBrush WRITE setShadesBrush NOTIFY shadesBrushChanged) |
|
58 | Q_PROPERTY(QBrush shadesBrush READ shadesBrush WRITE setShadesBrush NOTIFY shadesBrushChanged) | |
60 | //title |
|
59 | //title | |
61 | Q_PROPERTY(QString titleText READ titleText WRITE setTitleText NOTIFY titleTextChanged) |
|
60 | Q_PROPERTY(QString titleText READ titleText WRITE setTitleText NOTIFY titleTextChanged) | |
62 | Q_PROPERTY(QPen titlePen READ titlePen WRITE setTitlePen NOTIFY titlePenChanged) |
|
61 | Q_PROPERTY(QPen titlePen READ titlePen WRITE setTitlePen NOTIFY titlePenChanged) | |
63 | Q_PROPERTY(QBrush titleBrush READ titleBrush WRITE setTitleBrush NOTIFY titleBrushChanged) |
|
62 | Q_PROPERTY(QBrush titleBrush READ titleBrush WRITE setTitleBrush NOTIFY titleBrushChanged) | |
64 | Q_PROPERTY(bool titleVisible READ isTitleVisible WRITE setTitleVisible NOTIFY titleVisibleChanged) |
|
63 | Q_PROPERTY(bool titleVisible READ isTitleVisible WRITE setTitleVisible NOTIFY titleVisibleChanged) | |
65 | Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont NOTIFY titleFontChanged) |
|
64 | Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont NOTIFY titleFontChanged) | |
66 | //orientation |
|
65 | //orientation | |
67 | Q_PROPERTY(Qt::Orientation orientation READ orientation) |
|
66 | Q_PROPERTY(Qt::Orientation orientation READ orientation) | |
68 | //aligment |
|
67 | //aligment | |
69 | Q_PROPERTY(Qt::Alignment alignment READ alignment) |
|
68 | Q_PROPERTY(Qt::Alignment alignment READ alignment) | |
70 |
|
69 | |||
71 | public: |
|
70 | public: | |
72 |
|
71 | |||
73 | enum AxisType { |
|
72 | enum AxisType { | |
74 | AxisTypeNoAxis = 0x0, |
|
73 | AxisTypeNoAxis = 0x0, | |
75 | AxisTypeValue = 0x1, |
|
74 | AxisTypeValue = 0x1, | |
76 | AxisTypeBarCategory = 0x2, |
|
75 | AxisTypeBarCategory = 0x2, | |
77 | AxisTypeCategory = 0x3, |
|
76 | AxisTypeCategory = 0x3, | |
78 | AxisTypeDateTime = 0x4, |
|
77 | AxisTypeDateTime = 0x4, | |
79 | AxisTypeLogValue = 0x5 |
|
78 | AxisTypeLogValue = 0x5 | |
80 | }; |
|
79 | }; | |
81 |
|
80 | |||
82 | Q_DECLARE_FLAGS(AxisTypes, AxisType) |
|
81 | Q_DECLARE_FLAGS(AxisTypes, AxisType) | |
83 |
|
82 | |||
84 | protected: |
|
83 | protected: | |
85 | explicit QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent = 0); |
|
84 | explicit QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent = 0); | |
86 |
|
85 | |||
87 | public: |
|
86 | public: | |
88 | ~QAbstractAxis(); |
|
87 | ~QAbstractAxis(); | |
89 |
|
88 | |||
90 | virtual AxisType type() const = 0; |
|
89 | virtual AxisType type() const = 0; | |
91 |
|
90 | |||
92 | //visibility handling |
|
91 | //visibility handling | |
93 | bool isVisible() const; |
|
92 | bool isVisible() const; | |
94 | void setVisible(bool visible = true); |
|
93 | void setVisible(bool visible = true); | |
95 | void show(); |
|
94 | void show(); | |
96 | void hide(); |
|
95 | void hide(); | |
97 |
|
96 | |||
98 | //arrow handling |
|
97 | //arrow handling | |
99 | bool isLineVisible() const; |
|
98 | bool isLineVisible() const; | |
100 | void setLineVisible(bool visible = true); |
|
99 | void setLineVisible(bool visible = true); | |
101 | void setLinePen(const QPen &pen); |
|
100 | void setLinePen(const QPen &pen); | |
102 | QPen linePen() const; |
|
101 | QPen linePen() const; | |
103 | void setLinePenColor(QColor color); |
|
102 | void setLinePenColor(QColor color); | |
104 | QColor linePenColor() const; |
|
103 | QColor linePenColor() const; | |
105 |
|
104 | |||
106 | //grid handling |
|
105 | //grid handling | |
107 | bool isGridLineVisible() const; |
|
106 | bool isGridLineVisible() const; | |
108 | void setGridLineVisible(bool visible = true); |
|
107 | void setGridLineVisible(bool visible = true); | |
109 | void setGridLinePen(const QPen &pen); |
|
108 | void setGridLinePen(const QPen &pen); | |
110 | QPen gridLinePen() const; |
|
109 | QPen gridLinePen() const; | |
111 |
|
110 | |||
112 | //labels handling |
|
111 | //labels handling | |
113 | bool labelsVisible() const; |
|
112 | bool labelsVisible() const; | |
114 | void setLabelsVisible(bool visible = true); |
|
113 | void setLabelsVisible(bool visible = true); | |
115 | void setLabelsPen(const QPen &pen); |
|
114 | void setLabelsPen(const QPen &pen); | |
116 | QPen labelsPen() const; |
|
115 | QPen labelsPen() const; | |
117 | void setLabelsBrush(const QBrush &brush); |
|
116 | void setLabelsBrush(const QBrush &brush); | |
118 | QBrush labelsBrush() const; |
|
117 | QBrush labelsBrush() const; | |
119 | void setLabelsFont(const QFont &font); |
|
118 | void setLabelsFont(const QFont &font); | |
120 | QFont labelsFont() const; |
|
119 | QFont labelsFont() const; | |
121 | void setLabelsAngle(int angle); |
|
120 | void setLabelsAngle(int angle); | |
122 | int labelsAngle() const; |
|
121 | int labelsAngle() const; | |
123 | void setLabelsColor(QColor color); |
|
122 | void setLabelsColor(QColor color); | |
124 | QColor labelsColor() const; |
|
123 | QColor labelsColor() const; | |
125 |
|
124 | |||
126 | //title handling |
|
125 | //title handling | |
127 | bool isTitleVisible() const; |
|
126 | bool isTitleVisible() const; | |
128 | void setTitleVisible(bool visible = true); |
|
127 | void setTitleVisible(bool visible = true); | |
129 | void setTitlePen(const QPen &pen); |
|
128 | void setTitlePen(const QPen &pen); | |
130 | QPen titlePen() const; |
|
129 | QPen titlePen() const; | |
131 | void setTitleBrush(const QBrush &brush); |
|
130 | void setTitleBrush(const QBrush &brush); | |
132 | QBrush titleBrush() const; |
|
131 | QBrush titleBrush() const; | |
133 | void setTitleFont(const QFont &font); |
|
132 | void setTitleFont(const QFont &font); | |
134 | QFont titleFont() const; |
|
133 | QFont titleFont() const; | |
135 | void setTitleText(const QString &title); |
|
134 | void setTitleText(const QString &title); | |
136 | QString titleText() const; |
|
135 | QString titleText() const; | |
137 |
|
136 | |||
138 | //shades handling |
|
137 | //shades handling | |
139 | bool shadesVisible() const; |
|
138 | bool shadesVisible() const; | |
140 | void setShadesVisible(bool visible = true); |
|
139 | void setShadesVisible(bool visible = true); | |
141 | void setShadesPen(const QPen &pen); |
|
140 | void setShadesPen(const QPen &pen); | |
142 | QPen shadesPen() const; |
|
141 | QPen shadesPen() const; | |
143 | void setShadesBrush(const QBrush &brush); |
|
142 | void setShadesBrush(const QBrush &brush); | |
144 | QBrush shadesBrush() const; |
|
143 | QBrush shadesBrush() const; | |
145 | void setShadesColor(QColor color); |
|
144 | void setShadesColor(QColor color); | |
146 | QColor shadesColor() const; |
|
145 | QColor shadesColor() const; | |
147 | void setShadesBorderColor(QColor color); |
|
146 | void setShadesBorderColor(QColor color); | |
148 | QColor shadesBorderColor() const; |
|
147 | QColor shadesBorderColor() const; | |
149 |
|
148 | |||
150 | Qt::Orientation orientation(); //TODO: missing const <- BC |
|
149 | Qt::Orientation orientation(); //TODO: missing const <- BC | |
151 | Qt::Alignment alignment() const; |
|
150 | Qt::Alignment alignment() const; | |
152 |
|
151 | |||
153 | //range handling |
|
152 | //range handling | |
154 | void setMin(const QVariant &min); |
|
153 | void setMin(const QVariant &min); | |
155 | void setMax(const QVariant &max); |
|
154 | void setMax(const QVariant &max); | |
156 | void setRange(const QVariant &min, const QVariant &max); |
|
155 | void setRange(const QVariant &min, const QVariant &max); | |
157 |
|
156 | |||
158 | Q_SIGNALS: |
|
157 | Q_SIGNALS: | |
159 | void visibleChanged(bool visible); |
|
158 | void visibleChanged(bool visible); | |
160 | void linePenChanged(const QPen& pen); |
|
159 | void linePenChanged(const QPen& pen); | |
161 | void lineVisibleChanged(bool visible); |
|
160 | void lineVisibleChanged(bool visible); | |
162 | void labelsVisibleChanged(bool visible); |
|
161 | void labelsVisibleChanged(bool visible); | |
163 | void labelsPenChanged(const QPen& pen); |
|
162 | void labelsPenChanged(const QPen& pen); | |
164 | void labelsBrushChanged(const QBrush& brush); |
|
163 | void labelsBrushChanged(const QBrush& brush); | |
165 | void labelsFontChanged(const QFont& pen); |
|
164 | void labelsFontChanged(const QFont& pen); | |
166 | void labelsAngleChanged(int angle); |
|
165 | void labelsAngleChanged(int angle); | |
167 | void gridLinePenChanged(const QPen& pen); |
|
166 | void gridLinePenChanged(const QPen& pen); | |
168 | void gridVisibleChanged(bool visible); |
|
167 | void gridVisibleChanged(bool visible); | |
169 | void colorChanged(QColor color); |
|
168 | void colorChanged(QColor color); | |
170 | void labelsColorChanged(QColor color); |
|
169 | void labelsColorChanged(QColor color); | |
171 | void titleTextChanged(const QString& title); |
|
170 | void titleTextChanged(const QString& title); | |
172 | void titlePenChanged(const QPen& pen); |
|
171 | void titlePenChanged(const QPen& pen); | |
173 | void titleBrushChanged(const QBrush& brush); |
|
172 | void titleBrushChanged(const QBrush& brush); | |
174 | void titleVisibleChanged(bool visible); |
|
173 | void titleVisibleChanged(bool visible); | |
175 | void titleFontChanged(const QFont& font); |
|
174 | void titleFontChanged(const QFont& font); | |
176 | void shadesVisibleChanged(bool visible); |
|
175 | void shadesVisibleChanged(bool visible); | |
177 | void shadesColorChanged(QColor color); |
|
176 | void shadesColorChanged(QColor color); | |
178 | void shadesBorderColorChanged(QColor color); |
|
177 | void shadesBorderColorChanged(QColor color); | |
179 | void shadesPenChanged(const QPen& pen); |
|
178 | void shadesPenChanged(const QPen& pen); | |
180 | void shadesBrushChanged(const QBrush& brush); |
|
179 | void shadesBrushChanged(const QBrush& brush); | |
181 |
|
180 | |||
182 | protected: |
|
181 | protected: | |
183 | QScopedPointer<QAbstractAxisPrivate> d_ptr; |
|
182 | QScopedPointer<QAbstractAxisPrivate> d_ptr; | |
184 | Q_DISABLE_COPY(QAbstractAxis) |
|
183 | Q_DISABLE_COPY(QAbstractAxis) | |
185 | friend class ChartDataSet; |
|
184 | friend class ChartDataSet; | |
186 | friend class ChartAxis; |
|
185 | friend class ChartAxis; | |
187 | friend class ChartPresenter; |
|
186 | friend class ChartPresenter; | |
188 | friend class ChartThemeManager; |
|
187 | friend class ChartThemeManager; | |
189 | friend class AbstractDomain; |
|
188 | friend class AbstractDomain; | |
190 | }; |
|
189 | }; | |
191 |
|
190 | |||
192 | QTCOMMERCIALCHART_END_NAMESPACE |
|
191 | QTCOMMERCIALCHART_END_NAMESPACE | |
193 |
|
192 | |||
194 | #endif // QABSTRACTAXIS_H |
|
193 | #endif // QABSTRACTAXIS_H |
@@ -1,304 +1,319 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 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 | #include "qabstractseries.h" |
|
21 | #include "qabstractseries.h" | |
22 | #include "qabstractseries_p.h" |
|
22 | #include "qabstractseries_p.h" | |
23 | #include "chartdataset_p.h" |
|
23 | #include "chartdataset_p.h" | |
24 | #include "qchart.h" |
|
24 | #include "qchart.h" | |
25 | #include "qchart_p.h" |
|
25 | #include "qchart_p.h" | |
26 | #include "chartitem_p.h" |
|
26 | #include "chartitem_p.h" | |
27 | #include "xydomain_p.h" |
|
27 | #include "xydomain_p.h" | |
28 | #include "xlogydomain_p.h" |
|
28 | #include "xlogydomain_p.h" | |
29 | #include "logxydomain_p.h" |
|
29 | #include "logxydomain_p.h" | |
30 | #include "logxlogydomain_p.h" |
|
30 | #include "logxlogydomain_p.h" | |
31 |
|
31 | |||
32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
33 |
|
33 | |||
34 | /*! |
|
34 | /*! | |
35 | \class QAbstractSeries |
|
35 | \class QAbstractSeries | |
36 | \brief Base class for all QtCommercial Chart series. |
|
36 | \brief Base class for all QtCommercial Chart series. | |
37 | \mainclass |
|
37 | \mainclass | |
38 |
|
38 | |||
39 | Usually you use the series type specific inherited classes instead of the base class. |
|
39 | Usually you use the series type specific inherited classes instead of the base class. | |
40 | \sa QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QAbstractBarSeries, QStackedBarSeries, |
|
40 | \sa QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QAbstractBarSeries, QStackedBarSeries, | |
41 | QPercentBarSeries, QPieSeries |
|
41 | QPercentBarSeries, QPieSeries | |
42 | */ |
|
42 | */ | |
43 | /*! |
|
43 | /*! | |
44 | \qmlclass AbstractSeries |
|
44 | \qmlclass AbstractSeries | |
45 | AbstractSeries is the base class for all series. |
|
45 | AbstractSeries is the base class for all series. | |
46 | The class cannot be instantiated by the user. |
|
46 | The class cannot be instantiated by the user. | |
47 | */ |
|
47 | */ | |
48 |
|
48 | |||
49 | /*! |
|
49 | /*! | |
50 | \enum QAbstractSeries::SeriesType |
|
50 | \enum QAbstractSeries::SeriesType | |
51 |
|
51 | |||
52 | The type of the series object. |
|
52 | The type of the series object. | |
53 |
|
53 | |||
54 | \value SeriesTypeLine |
|
54 | \value SeriesTypeLine | |
55 | \value SeriesTypeArea |
|
55 | \value SeriesTypeArea | |
56 | \value SeriesTypeBar |
|
56 | \value SeriesTypeBar | |
57 | \value SeriesTypeStackedBar |
|
57 | \value SeriesTypeStackedBar | |
58 | \value SeriesTypePercentBar |
|
58 | \value SeriesTypePercentBar | |
59 | \value SeriesTypePie |
|
59 | \value SeriesTypePie | |
60 | \value SeriesTypeScatter |
|
60 | \value SeriesTypeScatter | |
61 | \value SeriesTypeSpline |
|
61 | \value SeriesTypeSpline | |
62 | \value SeriesTypeHorizontalBar |
|
62 | \value SeriesTypeHorizontalBar | |
63 | \value SeriesTypeHorizontalStackedBar |
|
63 | \value SeriesTypeHorizontalStackedBar | |
64 | \value SeriesTypeHorizontalPercentBar |
|
64 | \value SeriesTypeHorizontalPercentBar | |
65 | */ |
|
65 | */ | |
66 |
|
66 | |||
67 | /*! |
|
67 | /*! | |
68 | \property QAbstractSeries::type |
|
68 | \property QAbstractSeries::type | |
69 | The type of the series. |
|
69 | The type of the series. | |
70 | */ |
|
70 | */ | |
71 | /*! |
|
71 | /*! | |
72 | \qmlproperty ChartView.SeriesType AbstractSeries::type |
|
72 | \qmlproperty ChartView.SeriesType AbstractSeries::type | |
73 | The type of the series. |
|
73 | The type of the series. | |
74 | */ |
|
74 | */ | |
75 |
|
75 | |||
76 | /*! |
|
76 | /*! | |
77 | \property QAbstractSeries::name |
|
77 | \property QAbstractSeries::name | |
78 | \brief name of the series property. The name is shown in legend for QXYSeries. |
|
78 | \brief name of the series property. The name is shown in legend for QXYSeries. | |
79 | */ |
|
79 | */ | |
80 | /*! |
|
80 | /*! | |
81 | \qmlproperty string AbstractSeries::name |
|
81 | \qmlproperty string AbstractSeries::name | |
82 | Name of the series. The name is shown in legend for QXYSeries. |
|
82 | Name of the series. The name is shown in legend for QXYSeries. | |
83 | */ |
|
83 | */ | |
84 |
|
84 | |||
85 | /*! |
|
85 | /*! | |
86 | \fn void QAbstractSeries::nameChanged() |
|
86 | \fn void QAbstractSeries::nameChanged() | |
87 | This signal is emitted when the series name changes. |
|
87 | This signal is emitted when the series name changes. | |
88 | */ |
|
88 | */ | |
89 | /*! |
|
89 | /*! | |
90 | \qmlsignal AbstractSeries::onNameChanged() |
|
90 | \qmlsignal AbstractSeries::onNameChanged() | |
91 | This signal is emitted when the series name changes. |
|
91 | This signal is emitted when the series name changes. | |
92 | */ |
|
92 | */ | |
93 |
|
93 | |||
94 | /*! |
|
94 | /*! | |
95 | \property QAbstractSeries::visible |
|
95 | \property QAbstractSeries::visible | |
96 | \brief whether the series is visible or not; true by default. |
|
96 | \brief whether the series is visible or not; true by default. | |
97 | */ |
|
97 | */ | |
98 | /*! |
|
98 | /*! | |
99 | \qmlproperty bool AbstractSeries::visible |
|
99 | \qmlproperty bool AbstractSeries::visible | |
100 | Visibility of the series. True by default. |
|
100 | Visibility of the series. True by default. | |
101 | */ |
|
101 | */ | |
102 |
|
102 | |||
103 | /*! |
|
103 | /*! | |
104 | \fn void QAbstractSeries::visibleChanged() |
|
104 | \fn void QAbstractSeries::visibleChanged() | |
105 | Emitted when the series visibility changes. |
|
105 | Emitted when the series visibility changes. | |
106 | */ |
|
106 | */ | |
107 | /*! |
|
107 | /*! | |
108 | \qmlsignal AbstractSeries::onVisibleChanged() |
|
108 | \qmlsignal AbstractSeries::onVisibleChanged() | |
109 | Emitted when the series visibility changes. |
|
109 | Emitted when the series visibility changes. | |
110 | */ |
|
110 | */ | |
111 |
|
111 | |||
112 | /*! |
|
112 | /*! | |
113 | \property QAbstractSeries::opacity |
|
113 | \property QAbstractSeries::opacity | |
114 | \brief The opacity of the series. |
|
114 | \brief The opacity of the series. | |
115 | By default the opacity is 1.0. The valid values range from 0.0 (transparent) to 1.0 (opaque). |
|
115 | By default the opacity is 1.0. The valid values range from 0.0 (transparent) to 1.0 (opaque). | |
116 | */ |
|
116 | */ | |
117 | /*! |
|
117 | /*! | |
118 | \qmlproperty real AbstractSeries::opacity |
|
118 | \qmlproperty real AbstractSeries::opacity | |
119 | The opacity of the series. By default the opacity is 1.0. |
|
119 | The opacity of the series. By default the opacity is 1.0. | |
120 | The valid values range from 0.0 (transparent) to 1.0 (opaque). |
|
120 | The valid values range from 0.0 (transparent) to 1.0 (opaque). | |
121 | */ |
|
121 | */ | |
122 |
|
122 | |||
123 | /*! |
|
123 | /*! | |
124 | \fn void QAbstractSeries::opacityChanged() |
|
124 | \fn void QAbstractSeries::opacityChanged() | |
125 | Emitted when the opacity of the series changes. |
|
125 | Emitted when the opacity of the series changes. | |
126 | */ |
|
126 | */ | |
127 | /*! |
|
127 | /*! | |
128 | \qmlsignal AbstractSeries::onOpacityChanged() |
|
128 | \qmlsignal AbstractSeries::onOpacityChanged() | |
129 | Emitted when the opacity of the series changes. |
|
129 | Emitted when the opacity of the series changes. | |
130 | */ |
|
130 | */ | |
131 |
|
131 | |||
132 | /*! |
|
132 | /*! | |
133 | \internal |
|
133 | \internal | |
134 | \brief Constructs ChartSeries object with \a parent. |
|
134 | \brief Constructs ChartSeries object with \a parent. | |
135 | */ |
|
135 | */ | |
136 | QAbstractSeries::QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent) : |
|
136 | QAbstractSeries::QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent) : | |
137 | QObject(parent), |
|
137 | QObject(parent), | |
138 | d_ptr(&d) |
|
138 | d_ptr(&d) | |
139 | { |
|
139 | { | |
140 | } |
|
140 | } | |
141 |
|
141 | |||
142 | /*! |
|
142 | /*! | |
143 | \brief Virtual destructor for the chart series. |
|
143 | \brief Virtual destructor for the chart series. | |
144 | */ |
|
144 | */ | |
145 | QAbstractSeries::~QAbstractSeries() |
|
145 | QAbstractSeries::~QAbstractSeries() | |
146 | { |
|
146 | { | |
147 | if (d_ptr->m_chart) |
|
147 | if (d_ptr->m_chart) | |
148 | qFatal("Still binded series detected !"); |
|
148 | qFatal("Still binded series detected !"); | |
149 | } |
|
149 | } | |
150 |
|
150 | |||
151 | void QAbstractSeries::setName(const QString &name) |
|
151 | void QAbstractSeries::setName(const QString &name) | |
152 | { |
|
152 | { | |
153 | if (name != d_ptr->m_name) { |
|
153 | if (name != d_ptr->m_name) { | |
154 | d_ptr->m_name = name; |
|
154 | d_ptr->m_name = name; | |
155 | emit nameChanged(); |
|
155 | emit nameChanged(); | |
156 | } |
|
156 | } | |
157 | } |
|
157 | } | |
158 |
|
158 | |||
159 | QString QAbstractSeries::name() const |
|
159 | QString QAbstractSeries::name() const | |
160 | { |
|
160 | { | |
161 | return d_ptr->m_name; |
|
161 | return d_ptr->m_name; | |
162 | } |
|
162 | } | |
163 |
|
163 | |||
164 | /*! |
|
164 | /*! | |
165 | Sets the visibility of series to \a visible |
|
165 | Sets the visibility of series to \a visible | |
166 | */ |
|
166 | */ | |
167 | void QAbstractSeries::setVisible(bool visible) |
|
167 | void QAbstractSeries::setVisible(bool visible) | |
168 | { |
|
168 | { | |
169 | if (visible != d_ptr->m_visible) { |
|
169 | if (visible != d_ptr->m_visible) { | |
170 | d_ptr->m_visible = visible; |
|
170 | d_ptr->m_visible = visible; | |
171 | emit visibleChanged(); |
|
171 | emit visibleChanged(); | |
172 | } |
|
172 | } | |
173 | } |
|
173 | } | |
174 |
|
174 | |||
175 | /*! |
|
175 | /*! | |
176 | Returns the visibility of series |
|
176 | Returns the visibility of series | |
177 | */ |
|
177 | */ | |
178 | bool QAbstractSeries::isVisible() const |
|
178 | bool QAbstractSeries::isVisible() const | |
179 | { |
|
179 | { | |
180 | return d_ptr->m_visible; |
|
180 | return d_ptr->m_visible; | |
181 | } |
|
181 | } | |
182 |
|
182 | |||
183 | qreal QAbstractSeries::opacity() const |
|
183 | qreal QAbstractSeries::opacity() const | |
184 | { |
|
184 | { | |
185 | return d_ptr->m_opacity; |
|
185 | return d_ptr->m_opacity; | |
186 | } |
|
186 | } | |
187 |
|
187 | |||
188 | void QAbstractSeries::setOpacity(qreal opacity) |
|
188 | void QAbstractSeries::setOpacity(qreal opacity) | |
189 | { |
|
189 | { | |
190 | if (opacity != d_ptr->m_opacity) { |
|
190 | if (opacity != d_ptr->m_opacity) { | |
191 | d_ptr->m_opacity = opacity; |
|
191 | d_ptr->m_opacity = opacity; | |
192 | emit opacityChanged(); |
|
192 | emit opacityChanged(); | |
193 | } |
|
193 | } | |
194 | } |
|
194 | } | |
195 |
|
195 | |||
196 | /*! |
|
196 | /*! | |
197 | \brief Returns the chart where series belongs to. |
|
197 | \brief Returns the chart where series belongs to. | |
198 |
|
198 | |||
199 | Set automatically when the series is added to the chart |
|
199 | Set automatically when the series is added to the chart | |
200 | and unset when the series is removed from the chart. |
|
200 | and unset when the series is removed from the chart. | |
201 | */ |
|
201 | */ | |
202 | QChart *QAbstractSeries::chart() const |
|
202 | QChart *QAbstractSeries::chart() const | |
203 | { |
|
203 | { | |
204 | return d_ptr->m_chart; |
|
204 | return d_ptr->m_chart; | |
205 | } |
|
205 | } | |
206 |
|
206 | |||
207 | //void QAbstractSeries::adjustView() |
|
207 | //void QAbstractSeries::adjustView() | |
208 | //{ |
|
208 | //{ | |
209 | // //TODO: |
|
209 | // //TODO: | |
210 | //} |
|
210 | //} | |
211 |
|
211 | |||
212 | /*! |
|
212 | /*! | |
213 | \brief Sets the visibility of the series to true |
|
213 | \brief Sets the visibility of the series to true | |
214 |
|
214 | |||
215 | \sa setVisible(), isVisible() |
|
215 | \sa setVisible(), isVisible() | |
216 | */ |
|
216 | */ | |
217 | void QAbstractSeries::show() |
|
217 | void QAbstractSeries::show() | |
218 | { |
|
218 | { | |
219 | setVisible(true); |
|
219 | setVisible(true); | |
220 | } |
|
220 | } | |
221 |
|
221 | |||
222 | /*! |
|
222 | /*! | |
223 | \brief Sets the visibility of the series to false |
|
223 | \brief Sets the visibility of the series to false | |
224 |
|
224 | |||
225 | \sa setVisible(), isVisible() |
|
225 | \sa setVisible(), isVisible() | |
226 | */ |
|
226 | */ | |
227 | void QAbstractSeries::hide() |
|
227 | void QAbstractSeries::hide() | |
228 | { |
|
228 | { | |
229 | setVisible(false); |
|
229 | setVisible(false); | |
230 | } |
|
230 | } | |
231 |
|
231 | |||
|
232 | /*! | |||
|
233 | Attach \a axis to the series. | |||
|
234 | \return true if the axis was attached successfully, false otherwise. | |||
|
235 | \sa QChart::addAxis(), QChart::createDefaultAxes() | |||
|
236 | */ | |||
232 | bool QAbstractSeries::attachAxis(QAbstractAxis* axis) |
|
237 | bool QAbstractSeries::attachAxis(QAbstractAxis* axis) | |
233 | { |
|
238 | { | |
234 | if(d_ptr->m_chart) { |
|
239 | if(d_ptr->m_chart) { | |
235 | return d_ptr->m_chart->d_ptr->m_dataset->attachAxis(this,axis); |
|
240 | return d_ptr->m_chart->d_ptr->m_dataset->attachAxis(this, axis); | |
236 | } else { |
|
241 | } else { | |
237 | qWarning()<<"Series not in the chart. Please addSeries to chart first."; |
|
242 | qWarning()<<"Series not in the chart. Please addSeries to chart first."; | |
238 | return false; |
|
243 | return false; | |
239 | } |
|
244 | } | |
240 | } |
|
245 | } | |
241 |
|
246 | |||
|
247 | /*! | |||
|
248 | Detach \a axis from the series. | |||
|
249 | \return true if the axis was detached successfully, false otherwise. | |||
|
250 | \sa QChart::removeAxis() | |||
|
251 | */ | |||
242 | bool QAbstractSeries::detachAxis(QAbstractAxis* axis) |
|
252 | bool QAbstractSeries::detachAxis(QAbstractAxis* axis) | |
243 | { |
|
253 | { | |
244 | if(d_ptr->m_chart) { |
|
254 | if(d_ptr->m_chart) { | |
245 | return d_ptr->m_chart->d_ptr->m_dataset->detachAxis(this,axis); |
|
255 | return d_ptr->m_chart->d_ptr->m_dataset->detachAxis(this, axis); | |
246 | } |
|
256 | } | |
247 | else { |
|
257 | else { | |
248 | qWarning()<<"Series not in the chart. Please addSeries to chart first."; |
|
258 | qWarning()<<"Series not in the chart. Please addSeries to chart first."; | |
249 | return false; |
|
259 | return false; | |
250 | } |
|
260 | } | |
251 | } |
|
261 | } | |
252 |
|
262 | |||
|
263 | /*! | |||
|
264 | Returns the list of axes attached to the series. Usually there is an x-axis and a y-axis attached to a series, except | |||
|
265 | in case of a QPieSeries, which does not have any axes attached. | |||
|
266 | \sa attachAxis(), detachAxis() | |||
|
267 | */ | |||
253 | QList<QAbstractAxis*> QAbstractSeries::attachedAxes() |
|
268 | QList<QAbstractAxis*> QAbstractSeries::attachedAxes() | |
254 | { |
|
269 | { | |
255 | return d_ptr->m_axes; |
|
270 | return d_ptr->m_axes; | |
256 | } |
|
271 | } | |
257 |
|
272 | |||
258 | /////////////////////////////////////////////////////////////////////////////////////////////////// |
|
273 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
259 |
|
274 | |||
260 | QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries *q) |
|
275 | QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries *q) | |
261 | : q_ptr(q), |
|
276 | : q_ptr(q), | |
262 | m_chart(0), |
|
277 | m_chart(0), | |
263 | m_item(0), |
|
278 | m_item(0), | |
264 | m_domain(new XYDomain()), |
|
279 | m_domain(new XYDomain()), | |
265 | m_visible(true), |
|
280 | m_visible(true), | |
266 | m_opacity(1.0) |
|
281 | m_opacity(1.0) | |
267 | { |
|
282 | { | |
268 | } |
|
283 | } | |
269 |
|
284 | |||
270 | QAbstractSeriesPrivate::~QAbstractSeriesPrivate() |
|
285 | QAbstractSeriesPrivate::~QAbstractSeriesPrivate() | |
271 | { |
|
286 | { | |
272 | } |
|
287 | } | |
273 |
|
288 | |||
274 | void QAbstractSeriesPrivate::setDomain(AbstractDomain* domain) |
|
289 | void QAbstractSeriesPrivate::setDomain(AbstractDomain* domain) | |
275 | { |
|
290 | { | |
276 | Q_ASSERT(domain); |
|
291 | Q_ASSERT(domain); | |
277 | if(m_domain.data()!=domain) { |
|
292 | if(m_domain.data()!=domain) { | |
278 | if(!m_item.isNull()) QObject::disconnect(m_domain.data(), SIGNAL(updated()), m_item.data(), SLOT(handleDomainUpdated())); |
|
293 | if(!m_item.isNull()) QObject::disconnect(m_domain.data(), SIGNAL(updated()), m_item.data(), SLOT(handleDomainUpdated())); | |
279 | m_domain.reset(domain); |
|
294 | m_domain.reset(domain); | |
280 | if(!m_item.isNull()) { |
|
295 | if(!m_item.isNull()) { | |
281 | QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated())); |
|
296 | QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated())); | |
282 | m_item->handleDomainUpdated(); |
|
297 | m_item->handleDomainUpdated(); | |
283 | } |
|
298 | } | |
284 | } |
|
299 | } | |
285 | } |
|
300 | } | |
286 |
|
301 | |||
287 | void QAbstractSeriesPrivate::initializeGraphics(QGraphicsItem* parent) |
|
302 | void QAbstractSeriesPrivate::initializeGraphics(QGraphicsItem* parent) | |
288 | { |
|
303 | { | |
289 | Q_ASSERT(!m_item.isNull()); |
|
304 | Q_ASSERT(!m_item.isNull()); | |
290 | Q_UNUSED(parent); |
|
305 | Q_UNUSED(parent); | |
291 | QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated())); |
|
306 | QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated())); | |
292 | } |
|
307 | } | |
293 |
|
308 | |||
294 | void QAbstractSeriesPrivate::initializeAnimations(QChart::AnimationOptions options) |
|
309 | void QAbstractSeriesPrivate::initializeAnimations(QChart::AnimationOptions options) | |
295 | { |
|
310 | { | |
296 | Q_UNUSED(options); |
|
311 | Q_UNUSED(options); | |
297 | } |
|
312 | } | |
298 |
|
313 | |||
299 | #include "moc_qabstractseries.cpp" |
|
314 | #include "moc_qabstractseries.cpp" | |
300 | #include "moc_qabstractseries_p.cpp" |
|
315 | #include "moc_qabstractseries_p.cpp" | |
301 |
|
316 | |||
302 | QTCOMMERCIALCHART_END_NAMESPACE |
|
317 | QTCOMMERCIALCHART_END_NAMESPACE | |
303 |
|
318 | |||
304 |
|
319 |
General Comments 0
You need to be logged in to leave comments.
Login now