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