##// END OF EJS Templates
Block opengl series from being used as areaseries edges...
Miikka Heikkinen -
r2840:8f5b72388cbe
parent child
Show More
@@ -1,744 +1,748
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include <QtCharts/QAreaSeries>
19 #include <QtCharts/QAreaSeries>
20 #include <private/qareaseries_p.h>
20 #include <private/qareaseries_p.h>
21 #include <QtCharts/QLineSeries>
21 #include <QtCharts/QLineSeries>
22 #include <private/areachartitem_p.h>
22 #include <private/areachartitem_p.h>
23 #include <private/abstractdomain_p.h>
23 #include <private/abstractdomain_p.h>
24 #include <private/chartdataset_p.h>
24 #include <private/chartdataset_p.h>
25 #include <private/charttheme_p.h>
25 #include <private/charttheme_p.h>
26 #include <QtCharts/QValueAxis>
26 #include <QtCharts/QValueAxis>
27 #include <QtCharts/QAreaLegendMarker>
27 #include <QtCharts/QAreaLegendMarker>
28 #include <private/qchart_p.h>
28 #include <private/qchart_p.h>
29
29
30 QT_CHARTS_BEGIN_NAMESPACE
30 QT_CHARTS_BEGIN_NAMESPACE
31
31
32 /*!
32 /*!
33 \class QAreaSeries
33 \class QAreaSeries
34 \inmodule Qt Charts
34 \inmodule Qt Charts
35 \brief The QAreaSeries class is used for making area charts.
35 \brief The QAreaSeries class is used for making area charts.
36
36
37 An area series is used to show quantitative data. It is based on line series, in the way that
37 An area series is used to show quantitative data. It is based on line series, in the way that
38 the area between the boundary lines is emphasized with color. Since the area series is based on
38 the area between the boundary lines is emphasized with color. Since the area series is based on
39 line series, QAreaSeries constructor needs a QLineSeries instance, which defines "upper"
39 line series, QAreaSeries constructor needs a QLineSeries instance, which defines "upper"
40 boundary of the area. The area chart is drawn using the bottom of the plot area as the "lower"
40 boundary of the area. The area chart is drawn using the bottom of the plot area as the "lower"
41 boundary by default. Instead of the bottom of the plot area, the "lower" boundary can be
41 boundary by default. Instead of the bottom of the plot area, the "lower" boundary can be
42 specified by another line. In that case QAreaSeries should be initialized with two QLineSeries
42 specified by another line. In that case QAreaSeries should be initialized with two QLineSeries
43 instances. Please note that the terms "upper" and "lower" boundary can be misleading in cases
43 instances. Please note that the terms "upper" and "lower" boundary can be misleading in cases
44 where the "lower" boundary has bigger values than the "upper" one. The main point is that the
44 where the "lower" boundary has bigger values than the "upper" one. The main point is that the
45 area between these two boundary lines will be filled.
45 area between these two boundary lines will be filled.
46
46
47 See the \l {AreaChart Example} {area chart example} to learn how to create a simple area chart.
47 See the \l {AreaChart Example} {area chart example} to learn how to create a simple area chart.
48 \image examples_areachart.png
48 \image examples_areachart.png
49 */
49 */
50
50
51 /*!
51 /*!
52 \qmltype AreaSeries
52 \qmltype AreaSeries
53 \instantiates QAreaSeries
53 \instantiates QAreaSeries
54 \inqmlmodule QtCharts
54 \inqmlmodule QtCharts
55
55
56 \inherits AbstractSeries
56 \inherits AbstractSeries
57
57
58 \brief The AreaSeries type is used for making area charts.
58 \brief The AreaSeries type is used for making area charts.
59
59
60 The following QML shows how to create a simple area chart:
60 The following QML shows how to create a simple area chart:
61 \snippet qmlchart/qml/qmlchart/View4.qml 1
61 \snippet qmlchart/qml/qmlchart/View4.qml 1
62 \beginfloatleft
62 \beginfloatleft
63 \image examples_qmlchart4.png
63 \image examples_qmlchart4.png
64 \endfloat
64 \endfloat
65 \clearfloat
65 \clearfloat
66
66
67 \note Adding the same line series to chart and area series is not supported. The series used as
67 \note Adding the same line series to chart and area series is not supported. The series used as
68 boundary lines should be defined only for the area series.
68 boundary lines should be defined only for the area series.
69 */
69 */
70
70
71 /*!
71 /*!
72 \property QAreaSeries::upperSeries
72 \property QAreaSeries::upperSeries
73 \brief The upper one of the two line series used to define area series boundaries.
73 \brief The upper one of the two line series used to define area series boundaries.
74 */
74 */
75 /*!
75 /*!
76 \qmlproperty LineSeries AreaSeries::upperSeries
76 \qmlproperty LineSeries AreaSeries::upperSeries
77 The upper one of the two line series used to define area series boundaries.
77 The upper one of the two line series used to define area series boundaries.
78 */
78 */
79
79
80 /*!
80 /*!
81 \property QAreaSeries::lowerSeries
81 \property QAreaSeries::lowerSeries
82 The lower one of the two line series used to define are series boundaries. Note if
82 The lower one of the two line series used to define are series boundaries. Note if
83 QAreaSeries was constructed without a\ lowerSeries this is null.
83 QAreaSeries was constructed without a\ lowerSeries this is null.
84 */
84 */
85 /*!
85 /*!
86 \qmlproperty LineSeries AreaSeries::lowerSeries
86 \qmlproperty LineSeries AreaSeries::lowerSeries
87 The lower one of the two line series used to define are series boundaries. Note if
87 The lower one of the two line series used to define are series boundaries. Note if
88 AreaSeries was constructed without a\ lowerSeries this is null.
88 AreaSeries was constructed without a\ lowerSeries this is null.
89 */
89 */
90
90
91 /*!
91 /*!
92 \property QAreaSeries::color
92 \property QAreaSeries::color
93 Fill (brush) color of the series. This is a convenience property for modifying the color of brush.
93 Fill (brush) color of the series. This is a convenience property for modifying the color of brush.
94 \sa QAreaSeries::brush()
94 \sa QAreaSeries::brush()
95 */
95 */
96 /*!
96 /*!
97 \qmlproperty color AreaSeries::color
97 \qmlproperty color AreaSeries::color
98 Fill (brush) color of the series.
98 Fill (brush) color of the series.
99 */
99 */
100
100
101 /*!
101 /*!
102 \property QAreaSeries::borderColor
102 \property QAreaSeries::borderColor
103 Line (pen) color of the series. This is a convenience property for modifying the color of pen.
103 Line (pen) color of the series. This is a convenience property for modifying the color of pen.
104 \sa QAreaSeries::pen()
104 \sa QAreaSeries::pen()
105 */
105 */
106 /*!
106 /*!
107 \qmlproperty color AreaSeries::borderColor
107 \qmlproperty color AreaSeries::borderColor
108 Line (pen) color of the series.
108 Line (pen) color of the series.
109 */
109 */
110
110
111 /*!
111 /*!
112 \qmlproperty real AreaSeries::borderWidth
112 \qmlproperty real AreaSeries::borderWidth
113 The width of the border line. By default the width is 2.0.
113 The width of the border line. By default the width is 2.0.
114 */
114 */
115
115
116 /*!
116 /*!
117 \fn QPen QAreaSeries::pen() const
117 \fn QPen QAreaSeries::pen() const
118 \brief Returns the pen used to draw line for this series.
118 \brief Returns the pen used to draw line for this series.
119 \sa setPen()
119 \sa setPen()
120 */
120 */
121
121
122 /*!
122 /*!
123 \fn QPen QAreaSeries::brush() const
123 \fn QPen QAreaSeries::brush() const
124 \brief Returns the brush used to draw line for this series.
124 \brief Returns the brush used to draw line for this series.
125 \sa setBrush()
125 \sa setBrush()
126 */
126 */
127
127
128 /*!
128 /*!
129 \qmlproperty QString AreaSeries::brushFilename
129 \qmlproperty QString AreaSeries::brushFilename
130 The name of the file used as a brush image for the series.
130 The name of the file used as a brush image for the series.
131 */
131 */
132
132
133 /*!
133 /*!
134 \fn void QAreaSeries::colorChanged(QColor color)
134 \fn void QAreaSeries::colorChanged(QColor color)
135 \brief Signal is emitted when the fill (brush) color has changed to \a color.
135 \brief Signal is emitted when the fill (brush) color has changed to \a color.
136 */
136 */
137 /*!
137 /*!
138 \qmlsignal AreaSeries::onColorChanged(color color)
138 \qmlsignal AreaSeries::onColorChanged(color color)
139 Signal is emitted when the fill (brush) color has changed to \a color.
139 Signal is emitted when the fill (brush) color has changed to \a color.
140 */
140 */
141
141
142 /*!
142 /*!
143 \fn void QAreaSeries::borderColorChanged(QColor color)
143 \fn void QAreaSeries::borderColorChanged(QColor color)
144 \brief Signal is emitted when the line (pen) color has changed to \a color.
144 \brief Signal is emitted when the line (pen) color has changed to \a color.
145 */
145 */
146 /*!
146 /*!
147 \qmlsignal AreaSeries::onBorderColorChanged(color color)
147 \qmlsignal AreaSeries::onBorderColorChanged(color color)
148 Signal is emitted when the line (pen) color has changed to \a color.
148 Signal is emitted when the line (pen) color has changed to \a color.
149 */
149 */
150
150
151 /*!
151 /*!
152 \fn void QAreaSeries::clicked(const QPointF& point)
152 \fn void QAreaSeries::clicked(const QPointF& point)
153 \brief Signal is emitted when user clicks the \a point on area chart. The \a point is the point
153 \brief Signal is emitted when user clicks the \a point on area chart. The \a point is the point
154 where the press was triggered.
154 where the press was triggered.
155 \sa pressed, released, doubleClicked
155 \sa pressed, released, doubleClicked
156 */
156 */
157 /*!
157 /*!
158 \qmlsignal AreaSeries::onClicked(QPointF point)
158 \qmlsignal AreaSeries::onClicked(QPointF point)
159 Signal is emitted when user clicks the \a point on area chart. The \a point is the point where
159 Signal is emitted when user clicks the \a point on area chart. The \a point is the point where
160 the press was triggered.
160 the press was triggered.
161 \sa onPressed, onReleased, onDoubleClicked
161 \sa onPressed, onReleased, onDoubleClicked
162 */
162 */
163
163
164 /*!
164 /*!
165 \fn void QAreaSeries::hovered(const QPointF &point, bool state)
165 \fn void QAreaSeries::hovered(const QPointF &point, bool state)
166 This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
166 This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
167 of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
167 of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
168 the series.
168 the series.
169 */
169 */
170 /*!
170 /*!
171 \qmlsignal AreaSeries::onHovered(point point, bool state)
171 \qmlsignal AreaSeries::onHovered(point point, bool state)
172 This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
172 This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
173 of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
173 of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
174 the series.
174 the series.
175 */
175 */
176
176
177 /*!
177 /*!
178 \fn void QAreaSeries::pressed(const QPointF& point)
178 \fn void QAreaSeries::pressed(const QPointF& point)
179 \brief Signal is emitted when user presses the \a point on area chart.
179 \brief Signal is emitted when user presses the \a point on area chart.
180 \sa clicked, released, doubleClicked
180 \sa clicked, released, doubleClicked
181 */
181 */
182 /*!
182 /*!
183 \qmlsignal AreaSeries::onPressed(QPointF point)
183 \qmlsignal AreaSeries::onPressed(QPointF point)
184 Signal is emitted when user presses the \a point on area chart.
184 Signal is emitted when user presses the \a point on area chart.
185 \sa onClicked, onReleased, onDoubleClicked
185 \sa onClicked, onReleased, onDoubleClicked
186 */
186 */
187
187
188 /*!
188 /*!
189 \fn void QAreaSeries::released(const QPointF& point)
189 \fn void QAreaSeries::released(const QPointF& point)
190 \brief Signal is emitted when user releases a press that was triggered on a \a point on area
190 \brief Signal is emitted when user releases a press that was triggered on a \a point on area
191 chart.
191 chart.
192 \sa pressed, clicked, doubleClicked
192 \sa pressed, clicked, doubleClicked
193 */
193 */
194 /*!
194 /*!
195 \qmlsignal AreaSeries::onReleased(QPointF point)
195 \qmlsignal AreaSeries::onReleased(QPointF point)
196 Signal is emitted when user releases a press that was triggered on a \a point on area chart.
196 Signal is emitted when user releases a press that was triggered on a \a point on area chart.
197 \sa onPressed, onClicked, onDoubleClicked
197 \sa onPressed, onClicked, onDoubleClicked
198 */
198 */
199
199
200 /*!
200 /*!
201 \fn void QAreaSeries::doubleClicked(const QPointF& point)
201 \fn void QAreaSeries::doubleClicked(const QPointF& point)
202 \brief Signal is emitted when user doubleclicks the \a point on area chart. The \a point is the
202 \brief Signal is emitted when user doubleclicks the \a point on area chart. The \a point is the
203 point where the first press was triggered.
203 point where the first press was triggered.
204 \sa pressed, released, clicked
204 \sa pressed, released, clicked
205 */
205 */
206 /*!
206 /*!
207 \qmlsignal AreaSeries::onDoubleClicked(QPointF point)
207 \qmlsignal AreaSeries::onDoubleClicked(QPointF point)
208 Signal is emitted when user doubleclicks the \a point on area chart. The \a point is the point
208 Signal is emitted when user doubleclicks the \a point on area chart. The \a point is the point
209 where the first press was triggered.
209 where the first press was triggered.
210 \sa onPressed, onReleased, onClicked
210 \sa onPressed, onReleased, onClicked
211 */
211 */
212
212
213 /*!
213 /*!
214 \fn void QAreaSeries::selected()
214 \fn void QAreaSeries::selected()
215 The signal is emitted if the user selects/deselects the XY series. The logic for maintaining selections should be
215 The signal is emitted if the user selects/deselects the XY series. The logic for maintaining selections should be
216 implemented by the user of QAreaSeries API.
216 implemented by the user of QAreaSeries API.
217 */
217 */
218 /*!
218 /*!
219 \qmlsignal AreaSeries::onSelected()
219 \qmlsignal AreaSeries::onSelected()
220 The signal is emitted if the user selects/deselects the XY series. The logic for maintaining selections should be
220 The signal is emitted if the user selects/deselects the XY series. The logic for maintaining selections should be
221 implemented by the user of AreaSeries API.
221 implemented by the user of AreaSeries API.
222 */
222 */
223
223
224 /*!
224 /*!
225 \fn void QAreaSeriesPrivate::updated()
225 \fn void QAreaSeriesPrivate::updated()
226 \brief \internal
226 \brief \internal
227 */
227 */
228
228
229 /*!
229 /*!
230 \property QAreaSeries::pointLabelsFormat
230 \property QAreaSeries::pointLabelsFormat
231 The \a format used for showing labels with series points.
231 The \a format used for showing labels with series points.
232
232
233 QAreaSeries supports the following format tags:
233 QAreaSeries supports the following format tags:
234 \table
234 \table
235 \row
235 \row
236 \li @xPoint \li The x value of the data point
236 \li @xPoint \li The x value of the data point
237 \row
237 \row
238 \li @yPoint \li The y value of the data point
238 \li @yPoint \li The y value of the data point
239 \endtable
239 \endtable
240
240
241 For example, the following usage of the format tags would produce labels that have the data
241 For example, the following usage of the format tags would produce labels that have the data
242 point (x, y) shown inside brackets separated by a comma:
242 point (x, y) shown inside brackets separated by a comma:
243 \code
243 \code
244 series->setPointLabelsFormat("(@xPoint, @yPoint)");
244 series->setPointLabelsFormat("(@xPoint, @yPoint)");
245 \endcode
245 \endcode
246
246
247 By default, the labels format is set to '@xPoint, @yPoint'. The labels are shown on the plot
247 By default, the labels format is set to '@xPoint, @yPoint'. The labels are shown on the plot
248 area, labels on the edge of the plot area are cut. If the points are close to each other the
248 area, labels on the edge of the plot area are cut. If the points are close to each other the
249 labels may overlap.
249 labels may overlap.
250
250
251 \sa QAreaSeries::pointLabelsVisible, QAreaSeries::pointLabelsFont, QAreaSeries::pointLabelsColor
251 \sa QAreaSeries::pointLabelsVisible, QAreaSeries::pointLabelsFont, QAreaSeries::pointLabelsColor
252 */
252 */
253 /*!
253 /*!
254 \qmlproperty string AreaSeries::pointLabelsFormat
254 \qmlproperty string AreaSeries::pointLabelsFormat
255 The \a format used for showing labels with series points.
255 The \a format used for showing labels with series points.
256
256
257 \sa QAreaSeries::pointLabelsFormat, pointLabelsVisible, pointLabelsFont, pointLabelsColor
257 \sa QAreaSeries::pointLabelsFormat, pointLabelsVisible, pointLabelsFont, pointLabelsColor
258 */
258 */
259 /*!
259 /*!
260 \fn void QAreaSeries::pointLabelsFormatChanged(const QString &format)
260 \fn void QAreaSeries::pointLabelsFormatChanged(const QString &format)
261 Signal is emitted when the \a format of data point labels is changed.
261 Signal is emitted when the \a format of data point labels is changed.
262 */
262 */
263 /*!
263 /*!
264 \qmlsignal AreaSeries::onPointLabelsFormatChanged(string format)
264 \qmlsignal AreaSeries::onPointLabelsFormatChanged(string format)
265 Signal is emitted when the \a format of data point labels is changed.
265 Signal is emitted when the \a format of data point labels is changed.
266 */
266 */
267
267
268 /*!
268 /*!
269 \property QAreaSeries::pointLabelsVisible
269 \property QAreaSeries::pointLabelsVisible
270 Defines the visibility for data point labels. False by default.
270 Defines the visibility for data point labels. False by default.
271
271
272 \sa QAreaSeries::pointLabelsFormat, QAreaSeries::pointLabelsClipping
272 \sa QAreaSeries::pointLabelsFormat, QAreaSeries::pointLabelsClipping
273 */
273 */
274 /*!
274 /*!
275 \qmlproperty bool AreaSeries::pointLabelsVisible
275 \qmlproperty bool AreaSeries::pointLabelsVisible
276 Defines the visibility for data point labels.
276 Defines the visibility for data point labels.
277
277
278 \sa pointLabelsFormat, pointLabelsClipping
278 \sa pointLabelsFormat, pointLabelsClipping
279 */
279 */
280 /*!
280 /*!
281 \fn void QAreaSeries::pointLabelsVisibilityChanged(bool visible)
281 \fn void QAreaSeries::pointLabelsVisibilityChanged(bool visible)
282 The visibility of the data point labels is changed to \a visible.
282 The visibility of the data point labels is changed to \a visible.
283 */
283 */
284 /*!
284 /*!
285 \qmlsignal AreaSeries::onPointLabelsVisibilityChanged(bool visible)
285 \qmlsignal AreaSeries::onPointLabelsVisibilityChanged(bool visible)
286 The visibility of the data point labels is changed to \a visible.
286 The visibility of the data point labels is changed to \a visible.
287 */
287 */
288
288
289 /*!
289 /*!
290 \property QAreaSeries::pointLabelsFont
290 \property QAreaSeries::pointLabelsFont
291 Defines the font used for data point labels.
291 Defines the font used for data point labels.
292
292
293 \sa QAreaSeries::pointLabelsFormat
293 \sa QAreaSeries::pointLabelsFormat
294 */
294 */
295 /*!
295 /*!
296 \qmlproperty font AreaSeries::pointLabelsFont
296 \qmlproperty font AreaSeries::pointLabelsFont
297 Defines the font used for data point labels.
297 Defines the font used for data point labels.
298
298
299 \sa pointLabelsFormat
299 \sa pointLabelsFormat
300 */
300 */
301 /*!
301 /*!
302 \fn void QAreaSeries::pointLabelsFontChanged(const QFont &font);
302 \fn void QAreaSeries::pointLabelsFontChanged(const QFont &font);
303 The font used for data point labels is changed to \a font.
303 The font used for data point labels is changed to \a font.
304 */
304 */
305 /*!
305 /*!
306 \qmlsignal AreaSeries::onPointLabelsFontChanged(Font font)
306 \qmlsignal AreaSeries::onPointLabelsFontChanged(Font font)
307 The font used for data point labels is changed to \a font.
307 The font used for data point labels is changed to \a font.
308 */
308 */
309
309
310 /*!
310 /*!
311 \property QAreaSeries::pointLabelsColor
311 \property QAreaSeries::pointLabelsColor
312 Defines the color used for data point labels. By default, the color is the color of the brush
312 Defines the color used for data point labels. By default, the color is the color of the brush
313 defined in theme for labels.
313 defined in theme for labels.
314
314
315 \sa QAreaSeries::pointLabelsFormat
315 \sa QAreaSeries::pointLabelsFormat
316 */
316 */
317 /*!
317 /*!
318 \qmlproperty font AreaSeries::pointLabelsColor
318 \qmlproperty font AreaSeries::pointLabelsColor
319 Defines the color used for data point labels. By default, the color is the color of the brush
319 Defines the color used for data point labels. By default, the color is the color of the brush
320 defined in theme for labels.
320 defined in theme for labels.
321
321
322 \sa pointLabelsFormat
322 \sa pointLabelsFormat
323 */
323 */
324 /*!
324 /*!
325 \fn void QAreaSeries::pointLabelsColorChanged(const QColor &color);
325 \fn void QAreaSeries::pointLabelsColorChanged(const QColor &color);
326 The color used for data point labels is changed to \a color.
326 The color used for data point labels is changed to \a color.
327 */
327 */
328 /*!
328 /*!
329 \qmlsignal AreaSeries::onPointLabelsColorChanged(Color color)
329 \qmlsignal AreaSeries::onPointLabelsColorChanged(Color color)
330 The color used for data point labels is changed to \a color.
330 The color used for data point labels is changed to \a color.
331 */
331 */
332
332
333 /*!
333 /*!
334 \property QAreaSeries::pointLabelsClipping
334 \property QAreaSeries::pointLabelsClipping
335 Defines the clipping for data point labels. True by default. The labels on the edge of the plot
335 Defines the clipping for data point labels. True by default. The labels on the edge of the plot
336 area are cut when clipping is enabled.
336 area are cut when clipping is enabled.
337
337
338 \sa pointLabelsVisible
338 \sa pointLabelsVisible
339 */
339 */
340 /*!
340 /*!
341 \qmlproperty bool AreaSeries::pointLabelsClipping
341 \qmlproperty bool AreaSeries::pointLabelsClipping
342 Defines the clipping for data point labels. True by default. The labels on the edge of the plot
342 Defines the clipping for data point labels. True by default. The labels on the edge of the plot
343 area are cut when clipping is enabled.
343 area are cut when clipping is enabled.
344
344
345 \sa pointLabelsVisible
345 \sa pointLabelsVisible
346 */
346 */
347 /*!
347 /*!
348 \fn void QAreaSeries::pointLabelsClippingChanged(bool clipping)
348 \fn void QAreaSeries::pointLabelsClippingChanged(bool clipping)
349 The clipping of the data point labels is changed to \a clipping.
349 The clipping of the data point labels is changed to \a clipping.
350 */
350 */
351 /*!
351 /*!
352 \qmlsignal AreaSeries::onPointLabelsClippingChanged(bool clipping)
352 \qmlsignal AreaSeries::onPointLabelsClippingChanged(bool clipping)
353 The clipping of the data point labels is changed to \a clipping.
353 The clipping of the data point labels is changed to \a clipping.
354 */
354 */
355
355
356 /*!
356 /*!
357 Constructs area series object which is a child of \a upperSeries. Area will be spanned between \a
357 Constructs area series object which is a child of \a upperSeries. Area will be spanned between \a
358 upperSeries line and \a lowerSeries line. If no \a lowerSeries is passed to constructor, area is specified by axis x (y=0) instead.
358 upperSeries line and \a lowerSeries line. If no \a lowerSeries is passed to constructor, area is specified by axis x (y=0) instead.
359 When series object is added to QChartView or QChart instance ownerships is transferred.
359 When series object is added to QChartView or QChart instance ownerships is transferred.
360 */
360 */
361 QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries)
361 QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries)
362 : QAbstractSeries(*new QAreaSeriesPrivate(upperSeries, lowerSeries, this), upperSeries)
362 : QAbstractSeries(*new QAreaSeriesPrivate(upperSeries, lowerSeries, this), upperSeries)
363 {
363 {
364 if (upperSeries)
365 upperSeries->d_ptr->setBlockOpenGL(true);
366 if (lowerSeries)
367 lowerSeries->d_ptr->setBlockOpenGL(true);
364 }
368 }
365
369
366 /*!
370 /*!
367 Constructs area series object without upper or lower series with \a parent object.
371 Constructs area series object without upper or lower series with \a parent object.
368 */
372 */
369 QAreaSeries::QAreaSeries(QObject *parent)
373 QAreaSeries::QAreaSeries(QObject *parent)
370 : QAbstractSeries(*new QAreaSeriesPrivate(0, 0, this), parent)
374 : QAbstractSeries(*new QAreaSeriesPrivate(0, 0, this), parent)
371 {
375 {
372 }
376 }
373
377
374 /*!
378 /*!
375 Destroys the object.
379 Destroys the object.
376 */
380 */
377 QAreaSeries::~QAreaSeries()
381 QAreaSeries::~QAreaSeries()
378 {
382 {
379 Q_D(QAreaSeries);
383 Q_D(QAreaSeries);
380 if (d->m_chart)
384 if (d->m_chart)
381 d->m_chart->removeSeries(this);
385 d->m_chart->removeSeries(this);
382 }
386 }
383
387
384 /*!
388 /*!
385 Returns QAbstractSeries::SeriesTypeArea.
389 Returns QAbstractSeries::SeriesTypeArea.
386 */
390 */
387 QAbstractSeries::SeriesType QAreaSeries::type() const
391 QAbstractSeries::SeriesType QAreaSeries::type() const
388 {
392 {
389 return QAbstractSeries::SeriesTypeArea;
393 return QAbstractSeries::SeriesTypeArea;
390 }
394 }
391
395
392 /*!
396 /*!
393 Sets the \a series that is to be used as the area chart upper series.
397 Sets the \a series that is to be used as the area chart upper series.
394 */
398 */
395 void QAreaSeries::setUpperSeries(QLineSeries *series)
399 void QAreaSeries::setUpperSeries(QLineSeries *series)
396 {
400 {
397 Q_D(QAreaSeries);
401 Q_D(QAreaSeries);
398 if (d->m_upperSeries != series) {
402 if (d->m_upperSeries != series) {
399 series->d_ptr->setBlockOpenGL(true);
403 series->d_ptr->setBlockOpenGL(true);
400 d->m_upperSeries = series;
404 d->m_upperSeries = series;
401 }
405 }
402 }
406 }
403
407
404 QLineSeries *QAreaSeries::upperSeries() const
408 QLineSeries *QAreaSeries::upperSeries() const
405 {
409 {
406 Q_D(const QAreaSeries);
410 Q_D(const QAreaSeries);
407 return d->m_upperSeries;
411 return d->m_upperSeries;
408 }
412 }
409
413
410 /*!
414 /*!
411 Sets the \a series that is to be used as the area chart lower series.
415 Sets the \a series that is to be used as the area chart lower series.
412 */
416 */
413 void QAreaSeries::setLowerSeries(QLineSeries *series)
417 void QAreaSeries::setLowerSeries(QLineSeries *series)
414 {
418 {
415 Q_D(QAreaSeries);
419 Q_D(QAreaSeries);
416 series->d_ptr->setBlockOpenGL(true);
420 series->d_ptr->setBlockOpenGL(true);
417 d->m_lowerSeries = series;
421 d->m_lowerSeries = series;
418 }
422 }
419
423
420 QLineSeries *QAreaSeries::lowerSeries() const
424 QLineSeries *QAreaSeries::lowerSeries() const
421 {
425 {
422 Q_D(const QAreaSeries);
426 Q_D(const QAreaSeries);
423 return d->m_lowerSeries;
427 return d->m_lowerSeries;
424 }
428 }
425
429
426 /*!
430 /*!
427 Sets \a pen used for drawing area outline.
431 Sets \a pen used for drawing area outline.
428 */
432 */
429 void QAreaSeries::setPen(const QPen &pen)
433 void QAreaSeries::setPen(const QPen &pen)
430 {
434 {
431 Q_D(QAreaSeries);
435 Q_D(QAreaSeries);
432 if (d->m_pen != pen) {
436 if (d->m_pen != pen) {
433 d->m_pen = pen;
437 d->m_pen = pen;
434 emit d->updated();
438 emit d->updated();
435 }
439 }
436 }
440 }
437
441
438 QPen QAreaSeries::pen() const
442 QPen QAreaSeries::pen() const
439 {
443 {
440 Q_D(const QAreaSeries);
444 Q_D(const QAreaSeries);
441 if (d->m_pen == QChartPrivate::defaultPen())
445 if (d->m_pen == QChartPrivate::defaultPen())
442 return QPen();
446 return QPen();
443 else
447 else
444 return d->m_pen;
448 return d->m_pen;
445 }
449 }
446
450
447 /*!
451 /*!
448 Sets \a brush used for filling the area.
452 Sets \a brush used for filling the area.
449 */
453 */
450 void QAreaSeries::setBrush(const QBrush &brush)
454 void QAreaSeries::setBrush(const QBrush &brush)
451 {
455 {
452 Q_D(QAreaSeries);
456 Q_D(QAreaSeries);
453 if (d->m_brush != brush) {
457 if (d->m_brush != brush) {
454 bool emitColorChanged = brush.color() != d->m_brush.color();
458 bool emitColorChanged = brush.color() != d->m_brush.color();
455 d->m_brush = brush;
459 d->m_brush = brush;
456 emit d->updated();
460 emit d->updated();
457 if (emitColorChanged)
461 if (emitColorChanged)
458 emit colorChanged(brush.color());
462 emit colorChanged(brush.color());
459 }
463 }
460 }
464 }
461
465
462 QBrush QAreaSeries::brush() const
466 QBrush QAreaSeries::brush() const
463 {
467 {
464 Q_D(const QAreaSeries);
468 Q_D(const QAreaSeries);
465 if (d->m_brush == QChartPrivate::defaultBrush())
469 if (d->m_brush == QChartPrivate::defaultBrush())
466 return QBrush();
470 return QBrush();
467 else
471 else
468 return d->m_brush;
472 return d->m_brush;
469 }
473 }
470
474
471 void QAreaSeries::setColor(const QColor &color)
475 void QAreaSeries::setColor(const QColor &color)
472 {
476 {
473 QBrush b = brush();
477 QBrush b = brush();
474 if (b == QBrush())
478 if (b == QBrush())
475 b.setStyle(Qt::SolidPattern);
479 b.setStyle(Qt::SolidPattern);
476 b.setColor(color);
480 b.setColor(color);
477 setBrush(b);
481 setBrush(b);
478 }
482 }
479
483
480 QColor QAreaSeries::color() const
484 QColor QAreaSeries::color() const
481 {
485 {
482 return brush().color();
486 return brush().color();
483 }
487 }
484
488
485 void QAreaSeries::setBorderColor(const QColor &color)
489 void QAreaSeries::setBorderColor(const QColor &color)
486 {
490 {
487 QPen p = pen();
491 QPen p = pen();
488 if (p.color() != color) {
492 if (p.color() != color) {
489 p.setColor(color);
493 p.setColor(color);
490 setPen(p);
494 setPen(p);
491 emit borderColorChanged(color);
495 emit borderColorChanged(color);
492 }
496 }
493 }
497 }
494
498
495 QColor QAreaSeries::borderColor() const
499 QColor QAreaSeries::borderColor() const
496 {
500 {
497 return pen().color();
501 return pen().color();
498 }
502 }
499
503
500 /*!
504 /*!
501 Sets if data points are \a visible and should be drawn on line.
505 Sets if data points are \a visible and should be drawn on line.
502 */
506 */
503 void QAreaSeries::setPointsVisible(bool visible)
507 void QAreaSeries::setPointsVisible(bool visible)
504 {
508 {
505 Q_D(QAreaSeries);
509 Q_D(QAreaSeries);
506 if (d->m_pointsVisible != visible) {
510 if (d->m_pointsVisible != visible) {
507 d->m_pointsVisible = visible;
511 d->m_pointsVisible = visible;
508 emit d->updated();
512 emit d->updated();
509 }
513 }
510 }
514 }
511
515
512 /*!
516 /*!
513 Returns if the points are drawn for this series.
517 Returns if the points are drawn for this series.
514 \sa setPointsVisible()
518 \sa setPointsVisible()
515 */
519 */
516 bool QAreaSeries::pointsVisible() const
520 bool QAreaSeries::pointsVisible() const
517 {
521 {
518 Q_D(const QAreaSeries);
522 Q_D(const QAreaSeries);
519 return d->m_pointsVisible;
523 return d->m_pointsVisible;
520 }
524 }
521
525
522 void QAreaSeries::setPointLabelsFormat(const QString &format)
526 void QAreaSeries::setPointLabelsFormat(const QString &format)
523 {
527 {
524 Q_D(QAreaSeries);
528 Q_D(QAreaSeries);
525 if (d->m_pointLabelsFormat != format) {
529 if (d->m_pointLabelsFormat != format) {
526 d->m_pointLabelsFormat = format;
530 d->m_pointLabelsFormat = format;
527 emit pointLabelsFormatChanged(format);
531 emit pointLabelsFormatChanged(format);
528 }
532 }
529 }
533 }
530
534
531 QString QAreaSeries::pointLabelsFormat() const
535 QString QAreaSeries::pointLabelsFormat() const
532 {
536 {
533 Q_D(const QAreaSeries);
537 Q_D(const QAreaSeries);
534 return d->m_pointLabelsFormat;
538 return d->m_pointLabelsFormat;
535 }
539 }
536
540
537 void QAreaSeries::setPointLabelsVisible(bool visible)
541 void QAreaSeries::setPointLabelsVisible(bool visible)
538 {
542 {
539 Q_D(QAreaSeries);
543 Q_D(QAreaSeries);
540 if (d->m_pointLabelsVisible != visible) {
544 if (d->m_pointLabelsVisible != visible) {
541 d->m_pointLabelsVisible = visible;
545 d->m_pointLabelsVisible = visible;
542 emit pointLabelsVisibilityChanged(visible);
546 emit pointLabelsVisibilityChanged(visible);
543 }
547 }
544 }
548 }
545
549
546 bool QAreaSeries::pointLabelsVisible() const
550 bool QAreaSeries::pointLabelsVisible() const
547 {
551 {
548 Q_D(const QAreaSeries);
552 Q_D(const QAreaSeries);
549 return d->m_pointLabelsVisible;
553 return d->m_pointLabelsVisible;
550 }
554 }
551
555
552 void QAreaSeries::setPointLabelsFont(const QFont &font)
556 void QAreaSeries::setPointLabelsFont(const QFont &font)
553 {
557 {
554 Q_D(QAreaSeries);
558 Q_D(QAreaSeries);
555 if (d->m_pointLabelsFont != font) {
559 if (d->m_pointLabelsFont != font) {
556 d->m_pointLabelsFont = font;
560 d->m_pointLabelsFont = font;
557 emit pointLabelsFontChanged(font);
561 emit pointLabelsFontChanged(font);
558 }
562 }
559 }
563 }
560
564
561 QFont QAreaSeries::pointLabelsFont() const
565 QFont QAreaSeries::pointLabelsFont() const
562 {
566 {
563 Q_D(const QAreaSeries);
567 Q_D(const QAreaSeries);
564 return d->m_pointLabelsFont;
568 return d->m_pointLabelsFont;
565 }
569 }
566
570
567 void QAreaSeries::setPointLabelsColor(const QColor &color)
571 void QAreaSeries::setPointLabelsColor(const QColor &color)
568 {
572 {
569 Q_D(QAreaSeries);
573 Q_D(QAreaSeries);
570 if (d->m_pointLabelsColor != color) {
574 if (d->m_pointLabelsColor != color) {
571 d->m_pointLabelsColor = color;
575 d->m_pointLabelsColor = color;
572 emit pointLabelsColorChanged(color);
576 emit pointLabelsColorChanged(color);
573 }
577 }
574 }
578 }
575
579
576 QColor QAreaSeries::pointLabelsColor() const
580 QColor QAreaSeries::pointLabelsColor() const
577 {
581 {
578 Q_D(const QAreaSeries);
582 Q_D(const QAreaSeries);
579 if (d->m_pointLabelsColor == QChartPrivate::defaultPen().color())
583 if (d->m_pointLabelsColor == QChartPrivate::defaultPen().color())
580 return QPen().color();
584 return QPen().color();
581 else
585 else
582 return d->m_pointLabelsColor;
586 return d->m_pointLabelsColor;
583 }
587 }
584
588
585 void QAreaSeries::setPointLabelsClipping(bool enabled)
589 void QAreaSeries::setPointLabelsClipping(bool enabled)
586 {
590 {
587 Q_D(QAreaSeries);
591 Q_D(QAreaSeries);
588 if (d->m_pointLabelsClipping != enabled) {
592 if (d->m_pointLabelsClipping != enabled) {
589 d->m_pointLabelsClipping = enabled;
593 d->m_pointLabelsClipping = enabled;
590 emit pointLabelsClippingChanged(enabled);
594 emit pointLabelsClippingChanged(enabled);
591 }
595 }
592 }
596 }
593
597
594 bool QAreaSeries::pointLabelsClipping() const
598 bool QAreaSeries::pointLabelsClipping() const
595 {
599 {
596 Q_D(const QAreaSeries);
600 Q_D(const QAreaSeries);
597 return d->m_pointLabelsClipping;
601 return d->m_pointLabelsClipping;
598 }
602 }
599
603
600 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
604 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
601
605
602 QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries, QAreaSeries *q)
606 QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries, QAreaSeries *q)
603 : QAbstractSeriesPrivate(q),
607 : QAbstractSeriesPrivate(q),
604 m_brush(QChartPrivate::defaultBrush()),
608 m_brush(QChartPrivate::defaultBrush()),
605 m_pen(QChartPrivate::defaultPen()),
609 m_pen(QChartPrivate::defaultPen()),
606 m_upperSeries(upperSeries),
610 m_upperSeries(upperSeries),
607 m_lowerSeries(lowerSeries),
611 m_lowerSeries(lowerSeries),
608 m_pointsVisible(false),
612 m_pointsVisible(false),
609 m_pointLabelsFormat(QLatin1String("@xPoint, @yPoint")),
613 m_pointLabelsFormat(QLatin1String("@xPoint, @yPoint")),
610 m_pointLabelsVisible(false),
614 m_pointLabelsVisible(false),
611 m_pointLabelsFont(QChartPrivate::defaultFont()),
615 m_pointLabelsFont(QChartPrivate::defaultFont()),
612 m_pointLabelsColor(QChartPrivate::defaultPen().color()),
616 m_pointLabelsColor(QChartPrivate::defaultPen().color()),
613 m_pointLabelsClipping(true)
617 m_pointLabelsClipping(true)
614 {
618 {
615 }
619 }
616
620
617 void QAreaSeriesPrivate::initializeDomain()
621 void QAreaSeriesPrivate::initializeDomain()
618 {
622 {
619 Q_Q(QAreaSeries);
623 Q_Q(QAreaSeries);
620
624
621 qreal minX(domain()->minX());
625 qreal minX(domain()->minX());
622 qreal minY(domain()->minY());
626 qreal minY(domain()->minY());
623 qreal maxX(domain()->maxX());
627 qreal maxX(domain()->maxX());
624 qreal maxY(domain()->maxY());
628 qreal maxY(domain()->maxY());
625
629
626 QLineSeries *upperSeries = q->upperSeries();
630 QLineSeries *upperSeries = q->upperSeries();
627 QLineSeries *lowerSeries = q->lowerSeries();
631 QLineSeries *lowerSeries = q->lowerSeries();
628
632
629 if (upperSeries) {
633 if (upperSeries) {
630 const QVector<QPointF> &points = upperSeries->pointsVector();
634 const QVector<QPointF> &points = upperSeries->pointsVector();
631
635
632 for (int i = 0; i < points.count(); i++) {
636 for (int i = 0; i < points.count(); i++) {
633 qreal x = points[i].x();
637 qreal x = points[i].x();
634 qreal y = points[i].y();
638 qreal y = points[i].y();
635 minX = qMin(minX, x);
639 minX = qMin(minX, x);
636 minY = qMin(minY, y);
640 minY = qMin(minY, y);
637 maxX = qMax(maxX, x);
641 maxX = qMax(maxX, x);
638 maxY = qMax(maxY, y);
642 maxY = qMax(maxY, y);
639 }
643 }
640 }
644 }
641 if (lowerSeries) {
645 if (lowerSeries) {
642 const QVector<QPointF> &points = lowerSeries->pointsVector();
646 const QVector<QPointF> &points = lowerSeries->pointsVector();
643
647
644 for (int i = 0; i < points.count(); i++) {
648 for (int i = 0; i < points.count(); i++) {
645 qreal x = points[i].x();
649 qreal x = points[i].x();
646 qreal y = points[i].y();
650 qreal y = points[i].y();
647 minX = qMin(minX, x);
651 minX = qMin(minX, x);
648 minY = qMin(minY, y);
652 minY = qMin(minY, y);
649 maxX = qMax(maxX, x);
653 maxX = qMax(maxX, x);
650 maxY = qMax(maxY, y);
654 maxY = qMax(maxY, y);
651 }
655 }
652 }
656 }
653
657
654 domain()->setRange(minX, maxX, minY, maxY);
658 domain()->setRange(minX, maxX, minY, maxY);
655 }
659 }
656
660
657 void QAreaSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
661 void QAreaSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
658 {
662 {
659 Q_Q(QAreaSeries);
663 Q_Q(QAreaSeries);
660 AreaChartItem *area = new AreaChartItem(q,parent);
664 AreaChartItem *area = new AreaChartItem(q,parent);
661 m_item.reset(area);
665 m_item.reset(area);
662 QAbstractSeriesPrivate::initializeGraphics(parent);
666 QAbstractSeriesPrivate::initializeGraphics(parent);
663 }
667 }
664 void QAreaSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration,
668 void QAreaSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration,
665 QEasingCurve &curve)
669 QEasingCurve &curve)
666 {
670 {
667 Q_Q(QAreaSeries);
671 Q_Q(QAreaSeries);
668 AreaChartItem *area = static_cast<AreaChartItem *>(m_item.data());
672 AreaChartItem *area = static_cast<AreaChartItem *>(m_item.data());
669
673
670 if (q->upperSeries() && area->upperLineItem()->animation())
674 if (q->upperSeries() && area->upperLineItem()->animation())
671 area->upperLineItem()->animation()->stopAndDestroyLater();
675 area->upperLineItem()->animation()->stopAndDestroyLater();
672 if (q->lowerSeries() && area->lowerLineItem()->animation())
676 if (q->lowerSeries() && area->lowerLineItem()->animation())
673 area->lowerLineItem()->animation()->stopAndDestroyLater();
677 area->lowerLineItem()->animation()->stopAndDestroyLater();
674
678
675 if (options.testFlag(QChart::SeriesAnimations)) {
679 if (options.testFlag(QChart::SeriesAnimations)) {
676 area->upperLineItem()->setAnimation(new XYAnimation(area->upperLineItem(), duration,
680 area->upperLineItem()->setAnimation(new XYAnimation(area->upperLineItem(), duration,
677 curve));
681 curve));
678 if (q->lowerSeries())
682 if (q->lowerSeries())
679 area->lowerLineItem()->setAnimation(new XYAnimation(area->lowerLineItem(), duration,
683 area->lowerLineItem()->setAnimation(new XYAnimation(area->lowerLineItem(), duration,
680 curve));
684 curve));
681 } else {
685 } else {
682 if (q->upperSeries())
686 if (q->upperSeries())
683 area->upperLineItem()->setAnimation(0);
687 area->upperLineItem()->setAnimation(0);
684 if (q->lowerSeries())
688 if (q->lowerSeries())
685 area->lowerLineItem()->setAnimation(0);
689 area->lowerLineItem()->setAnimation(0);
686 }
690 }
687 QAbstractSeriesPrivate::initializeAnimations(options, duration, curve);
691 QAbstractSeriesPrivate::initializeAnimations(options, duration, curve);
688 }
692 }
689
693
690 QList<QLegendMarker*> QAreaSeriesPrivate::createLegendMarkers(QLegend* legend)
694 QList<QLegendMarker*> QAreaSeriesPrivate::createLegendMarkers(QLegend* legend)
691 {
695 {
692 Q_Q(QAreaSeries);
696 Q_Q(QAreaSeries);
693 QList<QLegendMarker*> list;
697 QList<QLegendMarker*> list;
694 return list << new QAreaLegendMarker(q,legend);
698 return list << new QAreaLegendMarker(q,legend);
695 }
699 }
696
700
697
701
698 void QAreaSeriesPrivate::initializeAxes()
702 void QAreaSeriesPrivate::initializeAxes()
699 {
703 {
700
704
701 }
705 }
702
706
703 QAbstractAxis::AxisType QAreaSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
707 QAbstractAxis::AxisType QAreaSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
704 {
708 {
705 Q_UNUSED(orientation);
709 Q_UNUSED(orientation);
706 return QAbstractAxis::AxisTypeValue;
710 return QAbstractAxis::AxisTypeValue;
707 }
711 }
708
712
709 QAbstractAxis* QAreaSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
713 QAbstractAxis* QAreaSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
710 {
714 {
711 Q_UNUSED(orientation);
715 Q_UNUSED(orientation);
712 return new QValueAxis;
716 return new QValueAxis;
713 }
717 }
714
718
715 void QAreaSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
719 void QAreaSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
716 {
720 {
717 Q_Q(QAreaSeries);
721 Q_Q(QAreaSeries);
718
722
719 const QList<QGradient> gradients = theme->seriesGradients();
723 const QList<QGradient> gradients = theme->seriesGradients();
720 const QList<QColor> colors = theme->seriesColors();
724 const QList<QColor> colors = theme->seriesColors();
721
725
722 if (forced || QChartPrivate::defaultPen() == m_pen) {
726 if (forced || QChartPrivate::defaultPen() == m_pen) {
723 QPen pen;
727 QPen pen;
724 pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0));
728 pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0));
725 pen.setWidthF(2);
729 pen.setWidthF(2);
726 q->setPen(pen);
730 q->setPen(pen);
727 }
731 }
728
732
729 if (forced || QChartPrivate::defaultBrush() == m_brush) {
733 if (forced || QChartPrivate::defaultBrush() == m_brush) {
730 QBrush brush(colors.at(index % colors.size()));
734 QBrush brush(colors.at(index % colors.size()));
731 q->setBrush(brush);
735 q->setBrush(brush);
732 }
736 }
733
737
734 if (forced || QChartPrivate::defaultPen().color() == m_pointLabelsColor) {
738 if (forced || QChartPrivate::defaultPen().color() == m_pointLabelsColor) {
735 QColor color = theme->labelBrush().color();
739 QColor color = theme->labelBrush().color();
736 q->setPointLabelsColor(color);
740 q->setPointLabelsColor(color);
737 }
741 }
738 }
742 }
739
743
740
744
741 #include "moc_qareaseries.cpp"
745 #include "moc_qareaseries.cpp"
742 #include "moc_qareaseries_p.cpp"
746 #include "moc_qareaseries_p.cpp"
743
747
744 QT_CHARTS_END_NAMESPACE
748 QT_CHARTS_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now