@@ -1,1020 +1,1020 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2013 Digia Plc |
|
3 | ** Copyright (C) 2013 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "qabstractaxis.h" |
|
21 | #include "qabstractaxis.h" | |
22 | #include "qabstractaxis_p.h" |
|
22 | #include "qabstractaxis_p.h" | |
23 | #include "chartdataset_p.h" |
|
23 | #include "chartdataset_p.h" | |
24 | #include "charttheme_p.h" |
|
24 | #include "charttheme_p.h" | |
25 | #include "qchart_p.h" |
|
25 | #include "qchart_p.h" | |
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
28 | |||
29 | /*! |
|
29 | /*! | |
30 | \class QAbstractAxis |
|
30 | \class QAbstractAxis | |
31 | \brief The QAbstractAxis class is used for manipulating chart's axis. |
|
31 | \brief The QAbstractAxis class is used for manipulating chart's axis. | |
32 | \mainclass |
|
32 | \mainclass | |
33 |
|
33 | |||
34 | Each series can be bound to one or more horizontal and vertical axes, but mixing axis types |
|
34 | Each series can be bound to one or more horizontal and vertical axes, but mixing axis types | |
35 | that would result in different domains is not supported, such as specifying |
|
35 | that would result in different domains is not supported, such as specifying | |
36 | QValueAxis and QLogValueAxis on the same orientation. |
|
36 | QValueAxis and QLogValueAxis on the same orientation. | |
37 |
|
37 | |||
38 | Properties and visibility of various axis elements such as axis line, title, labels, grid lines, |
|
38 | Properties and visibility of various axis elements such as axis line, title, labels, grid lines, | |
39 | and shades can be individually controlled. |
|
39 | and shades can be individually controlled. | |
40 | */ |
|
40 | */ | |
41 |
|
41 | |||
42 | /*! |
|
42 | /*! | |
43 | \qmlclass AbstractAxis QAbstractAxis |
|
43 | \qmlclass AbstractAxis QAbstractAxis | |
44 | \brief The AbstractAxis is a base element used for specialized axis elements. |
|
44 | \brief The AbstractAxis is a base element used for specialized axis elements. | |
45 |
|
45 | |||
46 | Each series can be bound to only one horizontal and vertical axis. |
|
46 | Each series can be bound to only one horizontal and vertical axis. | |
47 |
|
47 | |||
48 | Properties and visibility of various axis elements such as axis line, title, labels, grid lines, |
|
48 | Properties and visibility of various axis elements such as axis line, title, labels, grid lines, | |
49 | and shades can be individually controlled. |
|
49 | and shades can be individually controlled. | |
50 | */ |
|
50 | */ | |
51 |
|
51 | |||
52 | /*! |
|
52 | /*! | |
53 | \enum QAbstractAxis::AxisType |
|
53 | \enum QAbstractAxis::AxisType | |
54 |
|
54 | |||
55 | The type of the series object. |
|
55 | The type of the series object. | |
56 |
|
56 | |||
57 | \value AxisTypeNoAxis |
|
57 | \value AxisTypeNoAxis | |
58 | \value AxisTypeValue |
|
58 | \value AxisTypeValue | |
59 | \value AxisTypeBarCategory |
|
59 | \value AxisTypeBarCategory | |
60 | \value AxisTypeCategory |
|
60 | \value AxisTypeCategory | |
61 | \value AxisTypeDateTime |
|
61 | \value AxisTypeDateTime | |
62 | \value AxisTypeLogValue |
|
62 | \value AxisTypeLogValue | |
63 | */ |
|
63 | */ | |
64 |
|
64 | |||
65 | /*! |
|
65 | /*! | |
66 | *\fn void QAbstractAxis::type() const |
|
66 | *\fn void QAbstractAxis::type() const | |
67 | Returns the type of the axis |
|
67 | Returns the type of the axis | |
68 | */ |
|
68 | */ | |
69 |
|
69 | |||
70 | /*! |
|
70 | /*! | |
71 | \property QAbstractAxis::lineVisible |
|
71 | \property QAbstractAxis::lineVisible | |
72 | The visibility of the axis line |
|
72 | The visibility of the axis line | |
73 | */ |
|
73 | */ | |
74 | /*! |
|
74 | /*! | |
75 | \qmlproperty bool AbstractAxis::lineVisible |
|
75 | \qmlproperty bool AbstractAxis::lineVisible | |
76 | The visibility of the axis line |
|
76 | The visibility of the axis line | |
77 | */ |
|
77 | */ | |
78 |
|
78 | |||
79 | /*! |
|
79 | /*! | |
80 | \property QAbstractAxis::linePen |
|
80 | \property QAbstractAxis::linePen | |
81 | The pen of the line. |
|
81 | The pen of the line. | |
82 | */ |
|
82 | */ | |
83 |
|
83 | |||
84 | /*! |
|
84 | /*! | |
85 | \property QAbstractAxis::labelsVisible |
|
85 | \property QAbstractAxis::labelsVisible | |
86 | Defines if axis labels are visible. |
|
86 | Defines if axis labels are visible. | |
87 | */ |
|
87 | */ | |
88 | /*! |
|
88 | /*! | |
89 | \qmlproperty bool AbstractAxis::labelsVisible |
|
89 | \qmlproperty bool AbstractAxis::labelsVisible | |
90 | Defines if axis labels are visible. |
|
90 | Defines if axis labels are visible. | |
91 | */ |
|
91 | */ | |
92 |
|
92 | |||
93 | /*! |
|
93 | /*! | |
94 | \property QAbstractAxis::labelsPen |
|
94 | \property QAbstractAxis::labelsPen | |
95 | The pen of the labels. |
|
95 | The pen of the labels. | |
96 | */ |
|
96 | */ | |
97 |
|
97 | |||
98 | /*! |
|
98 | /*! | |
99 | \property QAbstractAxis::labelsBrush |
|
99 | \property QAbstractAxis::labelsBrush | |
100 | The brush of the labels. |
|
100 | The brush of the labels. | |
101 | */ |
|
101 | */ | |
102 |
|
102 | |||
103 | /*! |
|
103 | /*! | |
104 | \property QAbstractAxis::visible |
|
104 | \property QAbstractAxis::visible | |
105 | The visibility of the axis. |
|
105 | The visibility of the axis. | |
106 | */ |
|
106 | */ | |
107 | /*! |
|
107 | /*! | |
108 | \qmlproperty bool AbstractAxis::visible |
|
108 | \qmlproperty bool AbstractAxis::visible | |
109 | The visibility of the axis. |
|
109 | The visibility of the axis. | |
110 | */ |
|
110 | */ | |
111 |
|
111 | |||
112 | /*! |
|
112 | /*! | |
113 | \property QAbstractAxis::gridVisible |
|
113 | \property QAbstractAxis::gridVisible | |
114 | The visibility of the grid lines. |
|
114 | The visibility of the grid lines. | |
115 | */ |
|
115 | */ | |
116 | /*! |
|
116 | /*! | |
117 | \qmlproperty bool AbstractAxis::gridVisible |
|
117 | \qmlproperty bool AbstractAxis::gridVisible | |
118 | The visibility of the grid lines. |
|
118 | The visibility of the grid lines. | |
119 | */ |
|
119 | */ | |
120 |
|
120 | |||
121 | /*! |
|
121 | /*! | |
122 | \property QAbstractAxis::color |
|
122 | \property QAbstractAxis::color | |
123 | The color of the axis and ticks. |
|
123 | The color of the axis and ticks. | |
124 | */ |
|
124 | */ | |
125 | /*! |
|
125 | /*! | |
126 | \qmlproperty color AbstractAxis::color |
|
126 | \qmlproperty color AbstractAxis::color | |
127 | The color of the axis and ticks. |
|
127 | The color of the axis and ticks. | |
128 | */ |
|
128 | */ | |
129 |
|
129 | |||
130 | /*! |
|
130 | /*! | |
131 | \property QAbstractAxis::gridLinePen |
|
131 | \property QAbstractAxis::gridLinePen | |
132 | The pen of the grid line. |
|
132 | The pen of the grid line. | |
133 | */ |
|
133 | */ | |
134 |
|
134 | |||
135 | /*! |
|
135 | /*! | |
136 | \property QAbstractAxis::labelsFont |
|
136 | \property QAbstractAxis::labelsFont | |
137 | The font of the axis labels. |
|
137 | The font of the axis labels. | |
138 | */ |
|
138 | */ | |
139 |
|
139 | |||
140 | /*! |
|
140 | /*! | |
141 | \qmlproperty Font AbstractAxis::labelsFont |
|
141 | \qmlproperty Font AbstractAxis::labelsFont | |
142 | The font of the axis labels. |
|
142 | The font of the axis labels. | |
143 |
|
143 | |||
144 | See the \l {Font} {QML Font Element} for detailed documentation. |
|
144 | See the \l {Font} {QML Font Element} for detailed documentation. | |
145 | */ |
|
145 | */ | |
146 |
|
146 | |||
147 | /*! |
|
147 | /*! | |
148 | \property QAbstractAxis::labelsColor |
|
148 | \property QAbstractAxis::labelsColor | |
149 | The color of the axis labels. |
|
149 | The color of the axis labels. | |
150 | */ |
|
150 | */ | |
151 | /*! |
|
151 | /*! | |
152 | \qmlproperty color AbstractAxis::labelsColor |
|
152 | \qmlproperty color AbstractAxis::labelsColor | |
153 | The color of the axis labels. |
|
153 | The color of the axis labels. | |
154 | */ |
|
154 | */ | |
155 |
|
155 | |||
156 | /*! |
|
156 | /*! | |
157 | \property QAbstractAxis::labelsAngle |
|
157 | \property QAbstractAxis::labelsAngle | |
158 | The angle of the axis labels in degrees. |
|
158 | The angle of the axis labels in degrees. | |
159 | */ |
|
159 | */ | |
160 | /*! |
|
160 | /*! | |
161 | \qmlproperty int AbstractAxis::labelsAngle |
|
161 | \qmlproperty int AbstractAxis::labelsAngle | |
162 | The angle of the axis labels in degrees. |
|
162 | The angle of the axis labels in degrees. | |
163 | */ |
|
163 | */ | |
164 |
|
164 | |||
165 | /*! |
|
165 | /*! | |
166 | \property QAbstractAxis::shadesVisible |
|
166 | \property QAbstractAxis::shadesVisible | |
167 | The visibility of the axis shades. |
|
167 | The visibility of the axis shades. | |
168 | */ |
|
168 | */ | |
169 | /*! |
|
169 | /*! | |
170 | \qmlproperty bool AbstractAxis::shadesVisible |
|
170 | \qmlproperty bool AbstractAxis::shadesVisible | |
171 | The visibility of the axis shades. |
|
171 | The visibility of the axis shades. | |
172 | */ |
|
172 | */ | |
173 |
|
173 | |||
174 | /*! |
|
174 | /*! | |
175 | \property QAbstractAxis::shadesColor |
|
175 | \property QAbstractAxis::shadesColor | |
176 | The fill (brush) color of the axis shades. |
|
176 | The fill (brush) color of the axis shades. | |
177 | */ |
|
177 | */ | |
178 | /*! |
|
178 | /*! | |
179 | \qmlproperty color AbstractAxis::shadesColor |
|
179 | \qmlproperty color AbstractAxis::shadesColor | |
180 | The fill (brush) color of the axis shades. |
|
180 | The fill (brush) color of the axis shades. | |
181 | */ |
|
181 | */ | |
182 |
|
182 | |||
183 | /*! |
|
183 | /*! | |
184 | \property QAbstractAxis::shadesBorderColor |
|
184 | \property QAbstractAxis::shadesBorderColor | |
185 | The border (pen) color of the axis shades. |
|
185 | The border (pen) color of the axis shades. | |
186 | */ |
|
186 | */ | |
187 | /*! |
|
187 | /*! | |
188 | \qmlproperty color AbstractAxis::shadesBorderColor |
|
188 | \qmlproperty color AbstractAxis::shadesBorderColor | |
189 | The border (pen) color of the axis shades. |
|
189 | The border (pen) color of the axis shades. | |
190 | */ |
|
190 | */ | |
191 |
|
191 | |||
192 | /*! |
|
192 | /*! | |
193 | \property QAbstractAxis::shadesPen |
|
193 | \property QAbstractAxis::shadesPen | |
194 | The pen of the axis shades (area between grid lines). |
|
194 | The pen of the axis shades (area between grid lines). | |
195 | */ |
|
195 | */ | |
196 |
|
196 | |||
197 | /*! |
|
197 | /*! | |
198 | \property QAbstractAxis::shadesBrush |
|
198 | \property QAbstractAxis::shadesBrush | |
199 | The brush of the axis shades (area between grid lines). |
|
199 | The brush of the axis shades (area between grid lines). | |
200 | */ |
|
200 | */ | |
201 |
|
201 | |||
202 | /*! |
|
202 | /*! | |
203 | \property QAbstractAxis::titleVisible |
|
203 | \property QAbstractAxis::titleVisible | |
204 | The visibility of the axis title. By default the value is true. |
|
204 | The visibility of the axis title. By default the value is true. | |
205 | */ |
|
205 | */ | |
206 | /*! |
|
206 | /*! | |
207 | \qmlproperty bool AbstractAxis::titleVisible |
|
207 | \qmlproperty bool AbstractAxis::titleVisible | |
208 | The visibility of the axis title. By default the value is true. |
|
208 | The visibility of the axis title. By default the value is true. | |
209 | */ |
|
209 | */ | |
210 |
|
210 | |||
211 | /*! |
|
211 | /*! | |
212 | \property QAbstractAxis::titleText |
|
212 | \property QAbstractAxis::titleText | |
213 | The title of the axis. Empty by default. |
|
213 | The title of the axis. Empty by default. | |
214 | */ |
|
214 | */ | |
215 | /*! |
|
215 | /*! | |
216 | \qmlproperty String AbstractAxis::titleText |
|
216 | \qmlproperty String AbstractAxis::titleText | |
217 | The title of the axis. Empty by default. |
|
217 | The title of the axis. Empty by default. | |
218 | */ |
|
218 | */ | |
219 |
|
219 | |||
220 | /*! |
|
220 | /*! | |
221 | \property QAbstractAxis::titlePen |
|
221 | \property QAbstractAxis::titlePen | |
222 | The pen of the title text. |
|
222 | The pen of the title text. | |
223 | */ |
|
223 | */ | |
224 |
|
224 | |||
225 | /*! |
|
225 | /*! | |
226 | \property QAbstractAxis::titleBrush |
|
226 | \property QAbstractAxis::titleBrush | |
227 | The brush of the title text. |
|
227 | The brush of the title text. | |
228 | */ |
|
228 | */ | |
229 |
|
229 | |||
230 | /*! |
|
230 | /*! | |
231 | \property QAbstractAxis::titleFont |
|
231 | \property QAbstractAxis::titleFont | |
232 | The font of the title of the axis. |
|
232 | The font of the title of the axis. | |
233 | */ |
|
233 | */ | |
234 | /*! |
|
234 | /*! | |
235 | \qmlproperty Font AbstractAxis::titleFont |
|
235 | \qmlproperty Font AbstractAxis::titleFont | |
236 | The font of the title of the axis. |
|
236 | The font of the title of the axis. | |
237 | */ |
|
237 | */ | |
238 |
|
238 | |||
239 | /*! |
|
239 | /*! | |
240 | \property QAbstractAxis::orientation |
|
240 | \property QAbstractAxis::orientation | |
241 | The orientation of the axis. Fixed to either Qt::Horizontal or Qt::Vertical when you add the axis to a chart. |
|
241 | The orientation of the axis. Fixed to either Qt::Horizontal or Qt::Vertical when you add the axis to a chart. | |
242 | */ |
|
242 | */ | |
243 | /*! |
|
243 | /*! | |
244 | \qmlproperty Qt.Orientation AbstractAxis::orientation |
|
244 | \qmlproperty Qt.Orientation AbstractAxis::orientation | |
245 | The orientation of the axis. Fixed to either Qt.Horizontal or Qt.Vertical when the axis is set to a series. |
|
245 | The orientation of the axis. Fixed to either Qt.Horizontal or Qt.Vertical when the axis is set to a series. | |
246 | */ |
|
246 | */ | |
247 |
|
247 | |||
248 | /*! |
|
248 | /*! | |
249 | \property QAbstractAxis::alignment |
|
249 | \property QAbstractAxis::alignment | |
250 | The alignment of the axis. Can be Qt::AlignLeft, Qt::AlignRight, Qt::AlignBottom, or Qt::AlignTop. |
|
250 | The alignment of the axis. Can be Qt::AlignLeft, Qt::AlignRight, Qt::AlignBottom, or Qt::AlignTop. | |
251 | */ |
|
251 | */ | |
252 | /*! |
|
252 | /*! | |
253 | \qmlproperty alignment AbstractAxis::alignment |
|
253 | \qmlproperty alignment AbstractAxis::alignment | |
254 | The alignment of the axis. Can be Qt.AlignLeft, Qt.AlignRight, Qt.AlignBottom, or Qt.AlignTop. |
|
254 | The alignment of the axis. Can be Qt.AlignLeft, Qt.AlignRight, Qt.AlignBottom, or Qt.AlignTop. | |
255 | */ |
|
255 | */ | |
256 |
|
256 | |||
257 | /*! |
|
257 | /*! | |
258 | \fn void QAbstractAxis::visibleChanged(bool visible) |
|
258 | \fn void QAbstractAxis::visibleChanged(bool visible) | |
259 | Visibility of the axis has changed to \a visible. |
|
259 | Visibility of the axis has changed to \a visible. | |
260 | */ |
|
260 | */ | |
261 | /*! |
|
261 | /*! | |
262 | \qmlsignal AbstractAxis::onVisibleChanged(bool visible) |
|
262 | \qmlsignal AbstractAxis::onVisibleChanged(bool visible) | |
263 | Visibility of the axis has changed to \a visible. |
|
263 | Visibility of the axis has changed to \a visible. | |
264 | */ |
|
264 | */ | |
265 |
|
265 | |||
266 | /*! |
|
266 | /*! | |
267 | \fn void QAbstractAxis::linePenChanged(const QPen& pen) |
|
267 | \fn void QAbstractAxis::linePenChanged(const QPen& pen) | |
268 | The pen of the line of the axis has changed to \a pen. |
|
268 | The pen of the line of the axis has changed to \a pen. | |
269 | */ |
|
269 | */ | |
270 |
|
270 | |||
271 | /*! |
|
271 | /*! | |
272 | \fn void QAbstractAxis::lineVisibleChanged(bool visible) |
|
272 | \fn void QAbstractAxis::lineVisibleChanged(bool visible) | |
273 | Visibility of the axis line has changed to \a visible. |
|
273 | Visibility of the axis line has changed to \a visible. | |
274 | */ |
|
274 | */ | |
275 | /*! |
|
275 | /*! | |
276 | \qmlsignal AbstractAxis::onLineVisibleChanged(bool visible) |
|
276 | \qmlsignal AbstractAxis::onLineVisibleChanged(bool visible) | |
277 | Visibility of the axis line has changed to \a visible. |
|
277 | Visibility of the axis line has changed to \a visible. | |
278 | */ |
|
278 | */ | |
279 |
|
279 | |||
280 | /*! |
|
280 | /*! | |
281 | \fn void QAbstractAxis::labelsVisibleChanged(bool visible) |
|
281 | \fn void QAbstractAxis::labelsVisibleChanged(bool visible) | |
282 | Visibility of the labels of the axis has changed to \a visible. |
|
282 | Visibility of the labels of the axis has changed to \a visible. | |
283 | */ |
|
283 | */ | |
284 | /*! |
|
284 | /*! | |
285 | \qmlsignal AbstractAxis::onLabelsVisibleChanged(bool visible) |
|
285 | \qmlsignal AbstractAxis::onLabelsVisibleChanged(bool visible) | |
286 | Visibility of the labels of the axis has changed to \a visible. |
|
286 | Visibility of the labels of the axis has changed to \a visible. | |
287 | */ |
|
287 | */ | |
288 |
|
288 | |||
289 | /*! |
|
289 | /*! | |
290 | \fn void QAbstractAxis::labelsFontChanged(const QFont& font) |
|
290 | \fn void QAbstractAxis::labelsFontChanged(const QFont& font) | |
291 | The font of the axis labels has changed to \a font. |
|
291 | The font of the axis labels has changed to \a font. | |
292 | */ |
|
292 | */ | |
293 | /*! |
|
293 | /*! | |
294 | \qmlsignal AbstractAxis::onLabelsFontChanged(Font font) |
|
294 | \qmlsignal AbstractAxis::onLabelsFontChanged(Font font) | |
295 | The font of the axis labels has changed to \a font. |
|
295 | The font of the axis labels has changed to \a font. | |
296 | */ |
|
296 | */ | |
297 |
|
297 | |||
298 | /*! |
|
298 | /*! | |
299 | \fn void QAbstractAxis::labelsPenChanged(const QPen& pen) |
|
299 | \fn void QAbstractAxis::labelsPenChanged(const QPen& pen) | |
300 | The pen of the axis labels has changed to \a pen. |
|
300 | The pen of the axis labels has changed to \a pen. | |
301 | */ |
|
301 | */ | |
302 |
|
302 | |||
303 | /*! |
|
303 | /*! | |
304 | \fn void QAbstractAxis::labelsBrushChanged(const QBrush& brush) |
|
304 | \fn void QAbstractAxis::labelsBrushChanged(const QBrush& brush) | |
305 | The brush of the axis labels has changed to \a brush. |
|
305 | The brush of the axis labels has changed to \a brush. | |
306 | */ |
|
306 | */ | |
307 |
|
307 | |||
308 | /*! |
|
308 | /*! | |
309 | \fn void QAbstractAxis::labelsAngleChanged(int angle) |
|
309 | \fn void QAbstractAxis::labelsAngleChanged(int angle) | |
310 | The angle of the axis labels has changed to \a angle. |
|
310 | The angle of the axis labels has changed to \a angle. | |
311 | */ |
|
311 | */ | |
312 | /*! |
|
312 | /*! | |
313 | \qmlsignal AbstractAxis::onLabelsAngleChanged(int angle) |
|
313 | \qmlsignal AbstractAxis::onLabelsAngleChanged(int angle) | |
314 | The angle of the axis labels has changed to \a angle. |
|
314 | The angle of the axis labels has changed to \a angle. | |
315 | */ |
|
315 | */ | |
316 |
|
316 | |||
317 | /*! |
|
317 | /*! | |
318 | \fn void QAbstractAxis::gridVisibleChanged(bool visible) |
|
318 | \fn void QAbstractAxis::gridVisibleChanged(bool visible) | |
319 | Visibility of the grid lines of the axis has changed to \a visible. |
|
319 | Visibility of the grid lines of the axis has changed to \a visible. | |
320 | */ |
|
320 | */ | |
321 | /*! |
|
321 | /*! | |
322 | \qmlsignal AbstractAxis::onGridVisibleChanged(bool visible) |
|
322 | \qmlsignal AbstractAxis::onGridVisibleChanged(bool visible) | |
323 | Visibility of the grid lines of the axis has changed to \a visible. |
|
323 | Visibility of the grid lines of the axis has changed to \a visible. | |
324 | */ |
|
324 | */ | |
325 |
|
325 | |||
326 | /*! |
|
326 | /*! | |
327 | \fn void QAbstractAxis::gridLinePenChanged(const QPen& pen) |
|
327 | \fn void QAbstractAxis::gridLinePenChanged(const QPen& pen) | |
328 | The pen of the grid line has changed to \a pen. |
|
328 | The pen of the grid line has changed to \a pen. | |
329 | */ |
|
329 | */ | |
330 |
|
330 | |||
331 | /*! |
|
331 | /*! | |
332 | \fn void QAbstractAxis::colorChanged(QColor color) |
|
332 | \fn void QAbstractAxis::colorChanged(QColor color) | |
333 | Emitted if the \a color of the axis is changed. |
|
333 | Emitted if the \a color of the axis is changed. | |
334 | */ |
|
334 | */ | |
335 | /*! |
|
335 | /*! | |
336 | \qmlsignal AbstractAxis::onColorChanged(QColor color) |
|
336 | \qmlsignal AbstractAxis::onColorChanged(QColor color) | |
337 | Emitted if the \a color of the axis is changed. |
|
337 | Emitted if the \a color of the axis is changed. | |
338 | */ |
|
338 | */ | |
339 |
|
339 | |||
340 | /*! |
|
340 | /*! | |
341 | \fn void QAbstractAxis::labelsColorChanged(QColor color) |
|
341 | \fn void QAbstractAxis::labelsColorChanged(QColor color) | |
342 | Emitted if the \a color of the axis labels is changed. |
|
342 | Emitted if the \a color of the axis labels is changed. | |
343 | */ |
|
343 | */ | |
344 | /*! |
|
344 | /*! | |
345 | \qmlsignal AbstractAxis::onLabelsColorChanged(QColor color) |
|
345 | \qmlsignal AbstractAxis::onLabelsColorChanged(QColor color) | |
346 | Emitted if the \a color of the axis labels is changed. |
|
346 | Emitted if the \a color of the axis labels is changed. | |
347 | */ |
|
347 | */ | |
348 |
|
348 | |||
349 | /*! |
|
349 | /*! | |
350 | \fn void QAbstractAxis::titleVisibleChanged(bool visible) |
|
350 | \fn void QAbstractAxis::titleVisibleChanged(bool visible) | |
351 | Visibility of the title text of the axis has changed to \a visible. |
|
351 | Visibility of the title text of the axis has changed to \a visible. | |
352 | */ |
|
352 | */ | |
353 | /*! |
|
353 | /*! | |
354 | \qmlsignal AbstractAxis::onTitleVisibleChanged(bool visible) |
|
354 | \qmlsignal AbstractAxis::onTitleVisibleChanged(bool visible) | |
355 | Visibility of the title text of the axis has changed to \a visible. |
|
355 | Visibility of the title text of the axis has changed to \a visible. | |
356 | */ |
|
356 | */ | |
357 |
|
357 | |||
358 | /*! |
|
358 | /*! | |
359 | \fn void QAbstractAxis::titleTextChanged(const QString& text) |
|
359 | \fn void QAbstractAxis::titleTextChanged(const QString& text) | |
360 | The text of the axis title has changed to \a text. |
|
360 | The text of the axis title has changed to \a text. | |
361 | */ |
|
361 | */ | |
362 | /*! |
|
362 | /*! | |
363 | \qmlsignal AbstractAxis::onTitleTextChanged(String text) |
|
363 | \qmlsignal AbstractAxis::onTitleTextChanged(String text) | |
364 | The text of the axis title has changed to \a text. |
|
364 | The text of the axis title has changed to \a text. | |
365 | */ |
|
365 | */ | |
366 |
|
366 | |||
367 | /*! |
|
367 | /*! | |
368 | \fn void QAbstractAxis::titlePenChanged(const QPen& pen) |
|
368 | \fn void QAbstractAxis::titlePenChanged(const QPen& pen) | |
369 | The pen of the axis shades has changed to \a pen. |
|
369 | The pen of the axis shades has changed to \a pen. | |
370 | */ |
|
370 | */ | |
371 |
|
371 | |||
372 | /*! |
|
372 | /*! | |
373 | \fn void QAbstractAxis::titleBrushChanged(const QBrush& brush) |
|
373 | \fn void QAbstractAxis::titleBrushChanged(const QBrush& brush) | |
374 | The brush of the axis title has changed to \a brush. |
|
374 | The brush of the axis title has changed to \a brush. | |
375 | */ |
|
375 | */ | |
376 |
|
376 | |||
377 | /*! |
|
377 | /*! | |
378 | \fn void QAbstractAxis::titleFontChanged(const QFont& font) |
|
378 | \fn void QAbstractAxis::titleFontChanged(const QFont& font) | |
379 | The font of the axis title has changed to \a font. |
|
379 | The font of the axis title has changed to \a font. | |
380 | */ |
|
380 | */ | |
381 | /*! |
|
381 | /*! | |
382 | \qmlsignal AbstractAxis::onTitleFontChanged(Font font) |
|
382 | \qmlsignal AbstractAxis::onTitleFontChanged(Font font) | |
383 | The font of the axis title has changed to \a font. |
|
383 | The font of the axis title has changed to \a font. | |
384 | */ |
|
384 | */ | |
385 |
|
385 | |||
386 | /*! |
|
386 | /*! | |
387 | \fn void QAbstractAxis::shadesVisibleChanged(bool) |
|
387 | \fn void QAbstractAxis::shadesVisibleChanged(bool) | |
388 | Emitted if the visibility of the axis shades is changed to \a visible. |
|
388 | Emitted if the visibility of the axis shades is changed to \a visible. | |
389 | */ |
|
389 | */ | |
390 | /*! |
|
390 | /*! | |
391 | \qmlsignal AbstractAxis::onShadesVisibleChanged(bool visible) |
|
391 | \qmlsignal AbstractAxis::onShadesVisibleChanged(bool visible) | |
392 | Emitted if the visibility of the axis shades is changed to \a visible. |
|
392 | Emitted if the visibility of the axis shades is changed to \a visible. | |
393 | */ |
|
393 | */ | |
394 |
|
394 | |||
395 | /*! |
|
395 | /*! | |
396 | \fn void QAbstractAxis::shadesColorChanged(QColor color) |
|
396 | \fn void QAbstractAxis::shadesColorChanged(QColor color) | |
397 | Emitted if the \a color of the axis shades is changed. |
|
397 | Emitted if the \a color of the axis shades is changed. | |
398 | */ |
|
398 | */ | |
399 | /*! |
|
399 | /*! | |
400 | \qmlsignal AbstractAxis::onShadesColorChanged(QColor color) |
|
400 | \qmlsignal AbstractAxis::onShadesColorChanged(QColor color) | |
401 | Emitted if the \a color of the axis shades is changed. |
|
401 | Emitted if the \a color of the axis shades is changed. | |
402 | */ |
|
402 | */ | |
403 |
|
403 | |||
404 | /*! |
|
404 | /*! | |
405 | \fn void QAbstractAxis::shadesBorderColorChanged(QColor) |
|
405 | \fn void QAbstractAxis::shadesBorderColorChanged(QColor) | |
406 | Emitted if the border \a color of the axis shades is changed. |
|
406 | Emitted if the border \a color of the axis shades is changed. | |
407 | */ |
|
407 | */ | |
408 | /*! |
|
408 | /*! | |
409 | \qmlsignal AbstractAxis::onBorderColorChanged(QColor color) |
|
409 | \qmlsignal AbstractAxis::onBorderColorChanged(QColor color) | |
410 | Emitted if the border \a color of the axis shades is changed. |
|
410 | Emitted if the border \a color of the axis shades is changed. | |
411 | */ |
|
411 | */ | |
412 |
|
412 | |||
413 | /*! |
|
413 | /*! | |
414 | \fn void QAbstractAxis::shadesBrushChanged(const QBrush& brush) |
|
414 | \fn void QAbstractAxis::shadesBrushChanged(const QBrush& brush) | |
415 | The brush of the axis shades has changed to \a brush. |
|
415 | The brush of the axis shades has changed to \a brush. | |
416 | */ |
|
416 | */ | |
417 |
|
417 | |||
418 | /*! |
|
418 | /*! | |
419 | \fn void QAbstractAxis::shadesPenChanged(const QPen& pen) |
|
419 | \fn void QAbstractAxis::shadesPenChanged(const QPen& pen) | |
420 | The pen of the axis shades has changed to \a pen. |
|
420 | The pen of the axis shades has changed to \a pen. | |
421 | */ |
|
421 | */ | |
422 |
|
422 | |||
423 | /*! |
|
423 | /*! | |
424 | \internal |
|
424 | \internal | |
425 | Constructs new axis object which is a child of \a parent. Ownership is taken by |
|
425 | Constructs new axis object which is a child of \a parent. Ownership is taken by | |
426 | QChart when axis added. |
|
426 | QChart when axis added. | |
427 | */ |
|
427 | */ | |
428 |
|
428 | |||
429 | QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent) |
|
429 | QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent) | |
430 | : QObject(parent), |
|
430 | : QObject(parent), | |
431 | d_ptr(&d) |
|
431 | d_ptr(&d) | |
432 | { |
|
432 | { | |
433 | } |
|
433 | } | |
434 |
|
434 | |||
435 | /*! |
|
435 | /*! | |
436 | Destructor of the axis object. When axis is added to chart, chart object takes ownership. |
|
436 | Destructor of the axis object. When axis is added to chart, chart object takes ownership. | |
437 | */ |
|
437 | */ | |
438 |
|
438 | |||
439 | QAbstractAxis::~QAbstractAxis() |
|
439 | QAbstractAxis::~QAbstractAxis() | |
440 | { |
|
440 | { | |
441 | if (d_ptr->m_chart) |
|
441 | if (d_ptr->m_chart) | |
442 | qFatal("Still binded axis detected !"); |
|
442 | qFatal("Still binded axis detected !"); | |
443 | } |
|
443 | } | |
444 |
|
444 | |||
445 | /*! |
|
445 | /*! | |
446 | Sets \a pen used to draw axis line and ticks. |
|
446 | Sets \a pen used to draw axis line and ticks. | |
447 | */ |
|
447 | */ | |
448 | void QAbstractAxis::setLinePen(const QPen &pen) |
|
448 | void QAbstractAxis::setLinePen(const QPen &pen) | |
449 | { |
|
449 | { | |
450 | if (d_ptr->m_axisPen != pen) { |
|
450 | if (d_ptr->m_axisPen != pen) { | |
451 | d_ptr->m_axisPen = pen; |
|
451 | d_ptr->m_axisPen = pen; | |
452 | emit linePenChanged(pen); |
|
452 | emit linePenChanged(pen); | |
453 | } |
|
453 | } | |
454 | } |
|
454 | } | |
455 |
|
455 | |||
456 | /*! |
|
456 | /*! | |
457 | Returns pen used to draw axis and ticks. |
|
457 | Returns pen used to draw axis and ticks. | |
458 | */ |
|
458 | */ | |
459 | QPen QAbstractAxis::linePen() const |
|
459 | QPen QAbstractAxis::linePen() const | |
460 | { |
|
460 | { | |
461 | if (d_ptr->m_axisPen == QChartPrivate::defaultPen()) |
|
461 | if (d_ptr->m_axisPen == QChartPrivate::defaultPen()) | |
462 | return QPen(); |
|
462 | return QPen(); | |
463 | else |
|
463 | else | |
464 | return d_ptr->m_axisPen; |
|
464 | return d_ptr->m_axisPen; | |
465 | } |
|
465 | } | |
466 |
|
466 | |||
467 | //TODO: remove me 2.0 |
|
467 | //TODO: remove me 2.0 | |
468 | void QAbstractAxis::setLinePenColor(QColor color) |
|
468 | void QAbstractAxis::setLinePenColor(QColor color) | |
469 | { |
|
469 | { | |
470 | QPen p = d_ptr->m_axisPen; |
|
470 | QPen p = d_ptr->m_axisPen; | |
471 | if (p.color() != color) { |
|
471 | if (p.color() != color) { | |
472 | p.setColor(color); |
|
472 | p.setColor(color); | |
473 | setLinePen(p); |
|
473 | setLinePen(p); | |
474 | emit colorChanged(color); |
|
474 | emit colorChanged(color); | |
475 | } |
|
475 | } | |
476 | } |
|
476 | } | |
477 |
|
477 | |||
478 | QColor QAbstractAxis::linePenColor() const |
|
478 | QColor QAbstractAxis::linePenColor() const | |
479 | { |
|
479 | { | |
480 | return linePen().color(); |
|
480 | return linePen().color(); | |
481 | } |
|
481 | } | |
482 |
|
482 | |||
483 | /*! |
|
483 | /*! | |
484 | Sets if axis and ticks are \a visible. |
|
484 | Sets if axis and ticks are \a visible. | |
485 | */ |
|
485 | */ | |
486 | void QAbstractAxis::setLineVisible(bool visible) |
|
486 | void QAbstractAxis::setLineVisible(bool visible) | |
487 | { |
|
487 | { | |
488 | if (d_ptr->m_arrowVisible != visible) { |
|
488 | if (d_ptr->m_arrowVisible != visible) { | |
489 | d_ptr->m_arrowVisible = visible; |
|
489 | d_ptr->m_arrowVisible = visible; | |
490 | emit lineVisibleChanged(visible); |
|
490 | emit lineVisibleChanged(visible); | |
491 | } |
|
491 | } | |
492 | } |
|
492 | } | |
493 |
|
493 | |||
494 | bool QAbstractAxis::isLineVisible() const |
|
494 | bool QAbstractAxis::isLineVisible() const | |
495 | { |
|
495 | { | |
496 | return d_ptr->m_arrowVisible; |
|
496 | return d_ptr->m_arrowVisible; | |
497 | } |
|
497 | } | |
498 |
|
498 | |||
499 | void QAbstractAxis::setGridLineVisible(bool visible) |
|
499 | void QAbstractAxis::setGridLineVisible(bool visible) | |
500 | { |
|
500 | { | |
501 | if (d_ptr->m_gridLineVisible != visible) { |
|
501 | if (d_ptr->m_gridLineVisible != visible) { | |
502 | d_ptr->m_gridLineVisible = visible; |
|
502 | d_ptr->m_gridLineVisible = visible; | |
503 | emit gridVisibleChanged(visible); |
|
503 | emit gridVisibleChanged(visible); | |
504 | } |
|
504 | } | |
505 | } |
|
505 | } | |
506 |
|
506 | |||
507 | bool QAbstractAxis::isGridLineVisible() const |
|
507 | bool QAbstractAxis::isGridLineVisible() const | |
508 | { |
|
508 | { | |
509 | return d_ptr->m_gridLineVisible; |
|
509 | return d_ptr->m_gridLineVisible; | |
510 | } |
|
510 | } | |
511 |
|
511 | |||
512 | /*! |
|
512 | /*! | |
513 | Sets \a pen used to draw grid line. |
|
513 | Sets \a pen used to draw grid line. | |
514 | */ |
|
514 | */ | |
515 | void QAbstractAxis::setGridLinePen(const QPen &pen) |
|
515 | void QAbstractAxis::setGridLinePen(const QPen &pen) | |
516 | { |
|
516 | { | |
517 | if (d_ptr->m_gridLinePen != pen) { |
|
517 | if (d_ptr->m_gridLinePen != pen) { | |
518 | d_ptr->m_gridLinePen = pen; |
|
518 | d_ptr->m_gridLinePen = pen; | |
519 | emit gridLinePenChanged(pen); |
|
519 | emit gridLinePenChanged(pen); | |
520 | } |
|
520 | } | |
521 | } |
|
521 | } | |
522 |
|
522 | |||
523 | /*! |
|
523 | /*! | |
524 | Returns pen used to draw grid. |
|
524 | Returns pen used to draw grid. | |
525 | */ |
|
525 | */ | |
526 | QPen QAbstractAxis::gridLinePen() const |
|
526 | QPen QAbstractAxis::gridLinePen() const | |
527 | { |
|
527 | { | |
528 | if (d_ptr->m_gridLinePen == QChartPrivate::defaultPen()) |
|
528 | if (d_ptr->m_gridLinePen == QChartPrivate::defaultPen()) | |
529 | return QPen(); |
|
529 | return QPen(); | |
530 | else |
|
530 | else | |
531 | return d_ptr->m_gridLinePen; |
|
531 | return d_ptr->m_gridLinePen; | |
532 | } |
|
532 | } | |
533 |
|
533 | |||
534 | void QAbstractAxis::setLabelsVisible(bool visible) |
|
534 | void QAbstractAxis::setLabelsVisible(bool visible) | |
535 | { |
|
535 | { | |
536 | if (d_ptr->m_labelsVisible != visible) { |
|
536 | if (d_ptr->m_labelsVisible != visible) { | |
537 | d_ptr->m_labelsVisible = visible; |
|
537 | d_ptr->m_labelsVisible = visible; | |
538 | emit labelsVisibleChanged(visible); |
|
538 | emit labelsVisibleChanged(visible); | |
539 | } |
|
539 | } | |
540 | } |
|
540 | } | |
541 |
|
541 | |||
542 | bool QAbstractAxis::labelsVisible() const |
|
542 | bool QAbstractAxis::labelsVisible() const | |
543 | { |
|
543 | { | |
544 | return d_ptr->m_labelsVisible; |
|
544 | return d_ptr->m_labelsVisible; | |
545 | } |
|
545 | } | |
546 |
|
546 | |||
547 | /*! |
|
547 | /*! | |
548 | Sets \a pen used to draw labels. |
|
548 | Sets \a pen used to draw labels. | |
549 | */ |
|
549 | */ | |
550 | void QAbstractAxis::setLabelsPen(const QPen &pen) |
|
550 | void QAbstractAxis::setLabelsPen(const QPen &pen) | |
551 | { |
|
551 | { | |
552 | if (d_ptr->m_labelsPen != pen) { |
|
552 | if (d_ptr->m_labelsPen != pen) { | |
553 | d_ptr->m_labelsPen = pen; |
|
553 | d_ptr->m_labelsPen = pen; | |
554 | emit labelsPenChanged(pen); |
|
554 | emit labelsPenChanged(pen); | |
555 | } |
|
555 | } | |
556 | } |
|
556 | } | |
557 |
|
557 | |||
558 | /*! |
|
558 | /*! | |
559 | Returns the pen used to labels. |
|
559 | Returns the pen used to labels. | |
560 | */ |
|
560 | */ | |
561 | QPen QAbstractAxis::labelsPen() const |
|
561 | QPen QAbstractAxis::labelsPen() const | |
562 | { |
|
562 | { | |
563 | if (d_ptr->m_labelsPen == QChartPrivate::defaultPen()) |
|
563 | if (d_ptr->m_labelsPen == QChartPrivate::defaultPen()) | |
564 | return QPen(); |
|
564 | return QPen(); | |
565 | else |
|
565 | else | |
566 | return d_ptr->m_labelsPen; |
|
566 | return d_ptr->m_labelsPen; | |
567 | } |
|
567 | } | |
568 |
|
568 | |||
569 | /*! |
|
569 | /*! | |
570 | Sets \a brush used to draw labels. |
|
570 | Sets \a brush used to draw labels. | |
571 | */ |
|
571 | */ | |
572 | void QAbstractAxis::setLabelsBrush(const QBrush &brush) |
|
572 | void QAbstractAxis::setLabelsBrush(const QBrush &brush) | |
573 | { |
|
573 | { | |
574 | if (d_ptr->m_labelsBrush != brush) { |
|
574 | if (d_ptr->m_labelsBrush != brush) { | |
575 | d_ptr->m_labelsBrush = brush; |
|
575 | d_ptr->m_labelsBrush = brush; | |
576 | emit labelsBrushChanged(brush); |
|
576 | emit labelsBrushChanged(brush); | |
577 | } |
|
577 | } | |
578 | } |
|
578 | } | |
579 |
|
579 | |||
580 | /*! |
|
580 | /*! | |
581 | Returns brush used to draw labels. |
|
581 | Returns brush used to draw labels. | |
582 | */ |
|
582 | */ | |
583 | QBrush QAbstractAxis::labelsBrush() const |
|
583 | QBrush QAbstractAxis::labelsBrush() const | |
584 | { |
|
584 | { | |
585 | if (d_ptr->m_labelsBrush == QChartPrivate::defaultBrush()) |
|
585 | if (d_ptr->m_labelsBrush == QChartPrivate::defaultBrush()) | |
586 | return QBrush(); |
|
586 | return QBrush(); | |
587 | else |
|
587 | else | |
588 | return d_ptr->m_labelsBrush; |
|
588 | return d_ptr->m_labelsBrush; | |
589 | } |
|
589 | } | |
590 |
|
590 | |||
591 | /*! |
|
591 | /*! | |
592 | Sets \a font used to draw labels. |
|
592 | Sets \a font used to draw labels. | |
593 | */ |
|
593 | */ | |
594 | void QAbstractAxis::setLabelsFont(const QFont &font) |
|
594 | void QAbstractAxis::setLabelsFont(const QFont &font) | |
595 | { |
|
595 | { | |
596 | if (d_ptr->m_labelsFont != font) { |
|
596 | if (d_ptr->m_labelsFont != font) { | |
597 | d_ptr->m_labelsFont = font; |
|
597 | d_ptr->m_labelsFont = font; | |
598 | emit labelsFontChanged(font); |
|
598 | emit labelsFontChanged(font); | |
599 | } |
|
599 | } | |
600 | } |
|
600 | } | |
601 |
|
601 | |||
602 | /*! |
|
602 | /*! | |
603 | Returns font used to draw labels. |
|
603 | Returns font used to draw labels. | |
604 | */ |
|
604 | */ | |
605 | QFont QAbstractAxis::labelsFont() const |
|
605 | QFont QAbstractAxis::labelsFont() const | |
606 | { |
|
606 | { | |
607 | if (d_ptr->m_labelsFont == QChartPrivate::defaultFont()) |
|
607 | if (d_ptr->m_labelsFont == QChartPrivate::defaultFont()) | |
608 | return QFont(); |
|
608 | return QFont(); | |
609 | else |
|
609 | else | |
610 | return d_ptr->m_labelsFont; |
|
610 | return d_ptr->m_labelsFont; | |
611 | } |
|
611 | } | |
612 |
|
612 | |||
613 | void QAbstractAxis::setLabelsAngle(int angle) |
|
613 | void QAbstractAxis::setLabelsAngle(int angle) | |
614 | { |
|
614 | { | |
615 | if (d_ptr->m_labelsAngle != angle) { |
|
615 | if (d_ptr->m_labelsAngle != angle) { | |
616 | d_ptr->m_labelsAngle = angle; |
|
616 | d_ptr->m_labelsAngle = angle; | |
617 | emit labelsAngleChanged(angle); |
|
617 | emit labelsAngleChanged(angle); | |
618 | } |
|
618 | } | |
619 | } |
|
619 | } | |
620 |
|
620 | |||
621 | int QAbstractAxis::labelsAngle() const |
|
621 | int QAbstractAxis::labelsAngle() const | |
622 | { |
|
622 | { | |
623 | return d_ptr->m_labelsAngle; |
|
623 | return d_ptr->m_labelsAngle; | |
624 | } |
|
624 | } | |
625 | //TODO: remove me 2.0 |
|
625 | //TODO: remove me 2.0 | |
626 | void QAbstractAxis::setLabelsColor(QColor color) |
|
626 | void QAbstractAxis::setLabelsColor(QColor color) | |
627 | { |
|
627 | { | |
628 | QBrush b = d_ptr->m_labelsBrush; |
|
628 | QBrush b = d_ptr->m_labelsBrush; | |
629 | if (b.color() != color) { |
|
629 | if (b.color() != color) { | |
630 | b.setColor(color); |
|
630 | b.setColor(color); | |
631 | setLabelsBrush(b); |
|
631 | setLabelsBrush(b); | |
632 | emit labelsColorChanged(color); |
|
632 | emit labelsColorChanged(color); | |
633 | } |
|
633 | } | |
634 | } |
|
634 | } | |
635 |
|
635 | |||
636 | QColor QAbstractAxis::labelsColor() const |
|
636 | QColor QAbstractAxis::labelsColor() const | |
637 | { |
|
637 | { | |
638 | return labelsBrush().color(); |
|
638 | return labelsBrush().color(); | |
639 | } |
|
639 | } | |
640 |
|
640 | |||
641 | void QAbstractAxis::setTitleVisible(bool visible) |
|
641 | void QAbstractAxis::setTitleVisible(bool visible) | |
642 | { |
|
642 | { | |
643 | if (d_ptr->m_titleVisible != visible) { |
|
643 | if (d_ptr->m_titleVisible != visible) { | |
644 | d_ptr->m_titleVisible = visible; |
|
644 | d_ptr->m_titleVisible = visible; | |
645 | emit titleVisibleChanged(visible); |
|
645 | emit titleVisibleChanged(visible); | |
646 | } |
|
646 | } | |
647 | } |
|
647 | } | |
648 |
|
648 | |||
649 | bool QAbstractAxis::isTitleVisible() const |
|
649 | bool QAbstractAxis::isTitleVisible() const | |
650 | { |
|
650 | { | |
651 | return d_ptr->m_titleVisible; |
|
651 | return d_ptr->m_titleVisible; | |
652 | } |
|
652 | } | |
653 |
|
653 | |||
654 | /*! |
|
654 | /*! | |
655 | Sets \a pen used to draw title. |
|
655 | Sets \a pen used to draw title. | |
656 | */ |
|
656 | */ | |
657 | void QAbstractAxis::setTitlePen(const QPen &pen) |
|
657 | void QAbstractAxis::setTitlePen(const QPen &pen) | |
658 | { |
|
658 | { | |
659 | if (d_ptr->m_titlePen != pen) { |
|
659 | if (d_ptr->m_titlePen != pen) { | |
660 | d_ptr->m_titlePen = pen; |
|
660 | d_ptr->m_titlePen = pen; | |
661 | emit titlePenChanged(pen); |
|
661 | emit titlePenChanged(pen); | |
662 | } |
|
662 | } | |
663 | } |
|
663 | } | |
664 |
|
664 | |||
665 | /*! |
|
665 | /*! | |
666 | Returns the pen used to title. |
|
666 | Returns the pen used to title. | |
667 | */ |
|
667 | */ | |
668 | QPen QAbstractAxis::titlePen() const |
|
668 | QPen QAbstractAxis::titlePen() const | |
669 | { |
|
669 | { | |
670 | if (d_ptr->m_titlePen == QChartPrivate::defaultPen()) |
|
670 | if (d_ptr->m_titlePen == QChartPrivate::defaultPen()) | |
671 | return QPen(); |
|
671 | return QPen(); | |
672 | else |
|
672 | else | |
673 | return d_ptr->m_titlePen; |
|
673 | return d_ptr->m_titlePen; | |
674 | } |
|
674 | } | |
675 |
|
675 | |||
676 | /*! |
|
676 | /*! | |
677 | Sets \a brush used to draw title. |
|
677 | Sets \a brush used to draw title. | |
678 | */ |
|
678 | */ | |
679 | void QAbstractAxis::setTitleBrush(const QBrush &brush) |
|
679 | void QAbstractAxis::setTitleBrush(const QBrush &brush) | |
680 | { |
|
680 | { | |
681 | if (d_ptr->m_titleBrush != brush) { |
|
681 | if (d_ptr->m_titleBrush != brush) { | |
682 | d_ptr->m_titleBrush = brush; |
|
682 | d_ptr->m_titleBrush = brush; | |
683 | emit titleBrushChanged(brush); |
|
683 | emit titleBrushChanged(brush); | |
684 | } |
|
684 | } | |
685 | } |
|
685 | } | |
686 |
|
686 | |||
687 | /*! |
|
687 | /*! | |
688 | Returns brush used to draw title. |
|
688 | Returns brush used to draw title. | |
689 | */ |
|
689 | */ | |
690 | QBrush QAbstractAxis::titleBrush() const |
|
690 | QBrush QAbstractAxis::titleBrush() const | |
691 | { |
|
691 | { | |
692 | if (d_ptr->m_titleBrush == QChartPrivate::defaultBrush()) |
|
692 | if (d_ptr->m_titleBrush == QChartPrivate::defaultBrush()) | |
693 | return QBrush(); |
|
693 | return QBrush(); | |
694 | else |
|
694 | else | |
695 | return d_ptr->m_titleBrush; |
|
695 | return d_ptr->m_titleBrush; | |
696 | } |
|
696 | } | |
697 |
|
697 | |||
698 | /*! |
|
698 | /*! | |
699 | Sets \a font used to draw title. |
|
699 | Sets \a font used to draw title. | |
700 | */ |
|
700 | */ | |
701 | void QAbstractAxis::setTitleFont(const QFont &font) |
|
701 | void QAbstractAxis::setTitleFont(const QFont &font) | |
702 | { |
|
702 | { | |
703 | if (d_ptr->m_titleFont != font) { |
|
703 | if (d_ptr->m_titleFont != font) { | |
704 | d_ptr->m_titleFont = font; |
|
704 | d_ptr->m_titleFont = font; | |
705 | emit titleFontChanged(font); |
|
705 | emit titleFontChanged(font); | |
706 | } |
|
706 | } | |
707 | } |
|
707 | } | |
708 |
|
708 | |||
709 | /*! |
|
709 | /*! | |
710 | Returns font used to draw title. |
|
710 | Returns font used to draw title. | |
711 | */ |
|
711 | */ | |
712 | QFont QAbstractAxis::titleFont() const |
|
712 | QFont QAbstractAxis::titleFont() const | |
713 | { |
|
713 | { | |
714 | if (d_ptr->m_titleFont == QChartPrivate::defaultFont()) |
|
714 | if (d_ptr->m_titleFont == QChartPrivate::defaultFont()) | |
715 | return QFont(); |
|
715 | return QFont(); | |
716 | else |
|
716 | else | |
717 | return d_ptr->m_titleFont; |
|
717 | return d_ptr->m_titleFont; | |
718 | } |
|
718 | } | |
719 |
|
719 | |||
720 | void QAbstractAxis::setTitleText(const QString &title) |
|
720 | void QAbstractAxis::setTitleText(const QString &title) | |
721 | { |
|
721 | { | |
722 | if (d_ptr->m_title != title) { |
|
722 | if (d_ptr->m_title != title) { | |
723 | d_ptr->m_title = title; |
|
723 | d_ptr->m_title = title; | |
724 | emit titleTextChanged(title); |
|
724 | emit titleTextChanged(title); | |
725 | } |
|
725 | } | |
726 | } |
|
726 | } | |
727 |
|
727 | |||
728 | QString QAbstractAxis::titleText() const |
|
728 | QString QAbstractAxis::titleText() const | |
729 | { |
|
729 | { | |
730 | return d_ptr->m_title; |
|
730 | return d_ptr->m_title; | |
731 | } |
|
731 | } | |
732 |
|
732 | |||
733 |
|
733 | |||
734 | void QAbstractAxis::setShadesVisible(bool visible) |
|
734 | void QAbstractAxis::setShadesVisible(bool visible) | |
735 | { |
|
735 | { | |
736 | if (d_ptr->m_shadesVisible != visible) { |
|
736 | if (d_ptr->m_shadesVisible != visible) { | |
737 | d_ptr->m_shadesVisible = visible; |
|
737 | d_ptr->m_shadesVisible = visible; | |
738 | emit shadesVisibleChanged(visible); |
|
738 | emit shadesVisibleChanged(visible); | |
739 | } |
|
739 | } | |
740 | } |
|
740 | } | |
741 |
|
741 | |||
742 | bool QAbstractAxis::shadesVisible() const |
|
742 | bool QAbstractAxis::shadesVisible() const | |
743 | { |
|
743 | { | |
744 | return d_ptr->m_shadesVisible; |
|
744 | return d_ptr->m_shadesVisible; | |
745 | } |
|
745 | } | |
746 |
|
746 | |||
747 | /*! |
|
747 | /*! | |
748 | Sets \a pen used to draw shades. |
|
748 | Sets \a pen used to draw shades. | |
749 | */ |
|
749 | */ | |
750 | void QAbstractAxis::setShadesPen(const QPen &pen) |
|
750 | void QAbstractAxis::setShadesPen(const QPen &pen) | |
751 | { |
|
751 | { | |
752 | if (d_ptr->m_shadesPen != pen) { |
|
752 | if (d_ptr->m_shadesPen != pen) { | |
753 | d_ptr->m_shadesPen = pen; |
|
753 | d_ptr->m_shadesPen = pen; | |
754 | emit shadesPenChanged(pen); |
|
754 | emit shadesPenChanged(pen); | |
755 | } |
|
755 | } | |
756 | } |
|
756 | } | |
757 |
|
757 | |||
758 | /*! |
|
758 | /*! | |
759 | Returns pen used to draw shades. |
|
759 | Returns pen used to draw shades. | |
760 | */ |
|
760 | */ | |
761 | QPen QAbstractAxis::shadesPen() const |
|
761 | QPen QAbstractAxis::shadesPen() const | |
762 | { |
|
762 | { | |
763 | if (d_ptr->m_shadesPen == QChartPrivate::defaultPen()) |
|
763 | if (d_ptr->m_shadesPen == QChartPrivate::defaultPen()) | |
764 | return QPen(); |
|
764 | return QPen(); | |
765 | else |
|
765 | else | |
766 | return d_ptr->m_shadesPen; |
|
766 | return d_ptr->m_shadesPen; | |
767 | } |
|
767 | } | |
768 |
|
768 | |||
769 | /*! |
|
769 | /*! | |
770 | Sets \a brush used to draw shades. |
|
770 | Sets \a brush used to draw shades. | |
771 | */ |
|
771 | */ | |
772 | void QAbstractAxis::setShadesBrush(const QBrush &brush) |
|
772 | void QAbstractAxis::setShadesBrush(const QBrush &brush) | |
773 | { |
|
773 | { | |
774 | if (d_ptr->m_shadesBrush != brush) { |
|
774 | if (d_ptr->m_shadesBrush != brush) { | |
775 | d_ptr->m_shadesBrush = brush; |
|
775 | d_ptr->m_shadesBrush = brush; | |
776 | emit shadesBrushChanged(brush); |
|
776 | emit shadesBrushChanged(brush); | |
777 | } |
|
777 | } | |
778 | } |
|
778 | } | |
779 |
|
779 | |||
780 | /*! |
|
780 | /*! | |
781 | Returns brush used to draw shades. |
|
781 | Returns brush used to draw shades. | |
782 | */ |
|
782 | */ | |
783 | QBrush QAbstractAxis::shadesBrush() const |
|
783 | QBrush QAbstractAxis::shadesBrush() const | |
784 | { |
|
784 | { | |
785 | if (d_ptr->m_shadesBrush == QChartPrivate::defaultBrush()) |
|
785 | if (d_ptr->m_shadesBrush == QChartPrivate::defaultBrush()) | |
786 | return QBrush(Qt::SolidPattern); |
|
786 | return QBrush(Qt::SolidPattern); | |
787 | else |
|
787 | else | |
788 | return d_ptr->m_shadesBrush; |
|
788 | return d_ptr->m_shadesBrush; | |
789 | } |
|
789 | } | |
790 |
|
790 | |||
791 | void QAbstractAxis::setShadesColor(QColor color) |
|
791 | void QAbstractAxis::setShadesColor(QColor color) | |
792 | { |
|
792 | { | |
793 | QBrush b = d_ptr->m_shadesBrush; |
|
793 | QBrush b = d_ptr->m_shadesBrush; | |
794 | if (b.color() != color) { |
|
794 | if (b.color() != color) { | |
795 | b.setColor(color); |
|
795 | b.setColor(color); | |
796 | setShadesBrush(b); |
|
796 | setShadesBrush(b); | |
797 | emit shadesColorChanged(color); |
|
797 | emit shadesColorChanged(color); | |
798 | } |
|
798 | } | |
799 | } |
|
799 | } | |
800 |
|
800 | |||
801 | QColor QAbstractAxis::shadesColor() const |
|
801 | QColor QAbstractAxis::shadesColor() const | |
802 | { |
|
802 | { | |
803 | return shadesBrush().color(); |
|
803 | return shadesBrush().color(); | |
804 | } |
|
804 | } | |
805 |
|
805 | |||
806 | void QAbstractAxis::setShadesBorderColor(QColor color) |
|
806 | void QAbstractAxis::setShadesBorderColor(QColor color) | |
807 | { |
|
807 | { | |
808 | QPen p = d_ptr->m_shadesPen; |
|
808 | QPen p = d_ptr->m_shadesPen; | |
809 | if (p.color() != color) { |
|
809 | if (p.color() != color) { | |
810 | p.setColor(color); |
|
810 | p.setColor(color); | |
811 | setShadesPen(p); |
|
811 | setShadesPen(p); | |
812 | emit shadesColorChanged(color); |
|
812 | emit shadesColorChanged(color); | |
813 | } |
|
813 | } | |
814 | } |
|
814 | } | |
815 |
|
815 | |||
816 | QColor QAbstractAxis::shadesBorderColor() const |
|
816 | QColor QAbstractAxis::shadesBorderColor() const | |
817 | { |
|
817 | { | |
818 | return shadesPen().color(); |
|
818 | return shadesPen().color(); | |
819 | } |
|
819 | } | |
820 |
|
820 | |||
821 |
|
821 | |||
822 | bool QAbstractAxis::isVisible() const |
|
822 | bool QAbstractAxis::isVisible() const | |
823 | { |
|
823 | { | |
824 | return d_ptr->m_visible; |
|
824 | return d_ptr->m_visible; | |
825 | } |
|
825 | } | |
826 |
|
826 | |||
827 | /*! |
|
827 | /*! | |
828 | Sets axis, shades, labels and grid lines to be visible. |
|
828 | Sets axis, shades, labels and grid lines to be visible. | |
829 | */ |
|
829 | */ | |
830 | void QAbstractAxis::setVisible(bool visible) |
|
830 | void QAbstractAxis::setVisible(bool visible) | |
831 | { |
|
831 | { | |
832 | if (d_ptr->m_visible != visible) { |
|
832 | if (d_ptr->m_visible != visible) { | |
833 | d_ptr->m_visible = visible; |
|
833 | d_ptr->m_visible = visible; | |
834 | emit visibleChanged(visible); |
|
834 | emit visibleChanged(visible); | |
835 | } |
|
835 | } | |
836 | } |
|
836 | } | |
837 |
|
837 | |||
838 |
|
838 | |||
839 | /*! |
|
839 | /*! | |
840 | Sets axis, shades, labels and grid lines to be visible. |
|
840 | Sets axis, shades, labels and grid lines to be visible. | |
841 | */ |
|
841 | */ | |
842 | void QAbstractAxis::show() |
|
842 | void QAbstractAxis::show() | |
843 | { |
|
843 | { | |
844 | setVisible(true); |
|
844 | setVisible(true); | |
845 | } |
|
845 | } | |
846 |
|
846 | |||
847 | /*! |
|
847 | /*! | |
848 | Sets axis, shades, labels and grid lines to not be visible. |
|
848 | Sets axis, shades, labels and grid lines to not be visible. | |
849 | */ |
|
849 | */ | |
850 | void QAbstractAxis::hide() |
|
850 | void QAbstractAxis::hide() | |
851 | { |
|
851 | { | |
852 | setVisible(false); |
|
852 | setVisible(false); | |
853 | } |
|
853 | } | |
854 |
|
854 | |||
855 | /*! |
|
855 | /*! | |
856 | Sets the minimum value shown on the axis. |
|
856 | Sets the minimum value shown on the axis. | |
857 | Depending on the actual axis type the \a min parameter is converted to appropriate type. |
|
857 | Depending on the actual axis type the \a min parameter is converted to appropriate type. | |
858 | If the conversion is impossible then the function call does nothing |
|
858 | If the conversion is impossible then the function call does nothing | |
859 | */ |
|
859 | */ | |
860 | void QAbstractAxis::setMin(const QVariant &min) |
|
860 | void QAbstractAxis::setMin(const QVariant &min) | |
861 | { |
|
861 | { | |
862 | d_ptr->setMin(min); |
|
862 | d_ptr->setMin(min); | |
863 | } |
|
863 | } | |
864 |
|
864 | |||
865 | /*! |
|
865 | /*! | |
866 | Sets the maximum value shown on the axis. |
|
866 | Sets the maximum value shown on the axis. | |
867 | Depending on the actual axis type the \a max parameter is converted to appropriate type. |
|
867 | Depending on the actual axis type the \a max parameter is converted to appropriate type. | |
868 | If the conversion is impossible then the function call does nothing |
|
868 | If the conversion is impossible then the function call does nothing | |
869 | */ |
|
869 | */ | |
870 | void QAbstractAxis::setMax(const QVariant &max) |
|
870 | void QAbstractAxis::setMax(const QVariant &max) | |
871 | { |
|
871 | { | |
872 | d_ptr->setMax(max); |
|
872 | d_ptr->setMax(max); | |
873 | } |
|
873 | } | |
874 |
|
874 | |||
875 | /*! |
|
875 | /*! | |
876 | Sets the range shown on the axis. |
|
876 | Sets the range shown on the axis. | |
877 | Depending on the actual axis type the \a min and \a max parameters are converted to appropriate types. |
|
877 | Depending on the actual axis type the \a min and \a max parameters are converted to appropriate types. | |
878 | If the conversion is impossible then the function call does nothing. |
|
878 | If the conversion is impossible then the function call does nothing. | |
879 | */ |
|
879 | */ | |
880 | void QAbstractAxis::setRange(const QVariant &min, const QVariant &max) |
|
880 | void QAbstractAxis::setRange(const QVariant &min, const QVariant &max) | |
881 | { |
|
881 | { | |
882 | d_ptr->setRange(min, max); |
|
882 | d_ptr->setRange(min, max); | |
883 | } |
|
883 | } | |
884 |
|
884 | |||
885 |
|
885 | |||
886 | /*! |
|
886 | /*! | |
887 | Returns the orientation in which the axis is being used (Vertical or Horizontal) |
|
887 | Returns the orientation in which the axis is being used (Vertical or Horizontal) | |
888 | */ |
|
888 | */ | |
889 | // NOTE: should have const but it breaks BC: |
|
889 | // NOTE: should have const but it breaks BC: | |
890 | // http://techbase.kde.org/Policies/Binary_Compatibility_Examples#Change_the_CV-qualifiers_of_a_member_function |
|
890 | // http://techbase.kde.org/Policies/Binary_Compatibility_Examples#Change_the_CV-qualifiers_of_a_member_function | |
891 | Qt::Orientation QAbstractAxis::orientation() |
|
891 | Qt::Orientation QAbstractAxis::orientation() | |
892 | { |
|
892 | { | |
893 | return d_ptr->orientation(); |
|
893 | return d_ptr->orientation(); | |
894 | } |
|
894 | } | |
895 |
|
895 | |||
896 | Qt::Alignment QAbstractAxis::alignment() const |
|
896 | Qt::Alignment QAbstractAxis::alignment() const | |
897 | { |
|
897 | { | |
898 | return d_ptr->alignment(); |
|
898 | return d_ptr->alignment(); | |
899 | } |
|
899 | } | |
900 |
|
900 | |||
901 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
901 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
902 |
|
902 | |||
903 | QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q) |
|
903 | QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q) | |
904 | : q_ptr(q), |
|
904 | : q_ptr(q), | |
905 | m_chart(0), |
|
905 | m_chart(0), | |
906 | m_alignment(0), |
|
906 | m_alignment(0), | |
907 | m_orientation(Qt::Orientation(0)), |
|
907 | m_orientation(Qt::Orientation(0)), | |
908 | m_visible(true), |
|
908 | m_visible(true), | |
909 | m_arrowVisible(true), |
|
909 | m_arrowVisible(true), | |
910 | m_axisPen(QChartPrivate::defaultPen()), |
|
910 | m_axisPen(QChartPrivate::defaultPen()), | |
911 | m_axisBrush(QChartPrivate::defaultBrush()), |
|
911 | m_axisBrush(QChartPrivate::defaultBrush()), | |
912 | m_gridLineVisible(true), |
|
912 | m_gridLineVisible(true), | |
913 | m_gridLinePen(QChartPrivate::defaultPen()), |
|
913 | m_gridLinePen(QChartPrivate::defaultPen()), | |
914 | m_labelsVisible(true), |
|
914 | m_labelsVisible(true), | |
915 | m_labelsPen(QChartPrivate::defaultPen()), |
|
915 | m_labelsPen(QChartPrivate::defaultPen()), | |
916 | m_labelsBrush(QChartPrivate::defaultBrush()), |
|
916 | m_labelsBrush(QChartPrivate::defaultBrush()), | |
917 | m_labelsFont(QChartPrivate::defaultFont()), |
|
917 | m_labelsFont(QChartPrivate::defaultFont()), | |
918 | m_labelsAngle(0), |
|
918 | m_labelsAngle(0), | |
919 | m_titleVisible(true), |
|
919 | m_titleVisible(true), | |
920 | m_titlePen(QChartPrivate::defaultPen()), |
|
920 | m_titlePen(QChartPrivate::defaultPen()), | |
921 | m_titleBrush(QChartPrivate::defaultBrush()), |
|
921 | m_titleBrush(QChartPrivate::defaultBrush()), | |
922 | m_titleFont(QChartPrivate::defaultFont()), |
|
922 | m_titleFont(QChartPrivate::defaultFont()), | |
923 | m_shadesVisible(false), |
|
923 | m_shadesVisible(false), | |
924 | m_shadesBrush(QChartPrivate::defaultBrush()), |
|
|||
925 | m_shadesPen(QChartPrivate::defaultPen()), |
|
924 | m_shadesPen(QChartPrivate::defaultPen()), | |
|
925 | m_shadesBrush(QChartPrivate::defaultBrush()), | |||
926 | m_shadesOpacity(1.0), |
|
926 | m_shadesOpacity(1.0), | |
927 | m_dirty(false) |
|
927 | m_dirty(false) | |
928 | { |
|
928 | { | |
929 | } |
|
929 | } | |
930 |
|
930 | |||
931 | QAbstractAxisPrivate::~QAbstractAxisPrivate() |
|
931 | QAbstractAxisPrivate::~QAbstractAxisPrivate() | |
932 | { |
|
932 | { | |
933 | } |
|
933 | } | |
934 |
|
934 | |||
935 | void QAbstractAxisPrivate::setAlignment( Qt::Alignment alignment) |
|
935 | void QAbstractAxisPrivate::setAlignment( Qt::Alignment alignment) | |
936 | { |
|
936 | { | |
937 | switch(alignment) { |
|
937 | switch(alignment) { | |
938 | case Qt::AlignTop: |
|
938 | case Qt::AlignTop: | |
939 | case Qt::AlignBottom: |
|
939 | case Qt::AlignBottom: | |
940 | m_orientation = Qt::Horizontal; |
|
940 | m_orientation = Qt::Horizontal; | |
941 | break; |
|
941 | break; | |
942 | case Qt::AlignLeft: |
|
942 | case Qt::AlignLeft: | |
943 | case Qt::AlignRight: |
|
943 | case Qt::AlignRight: | |
944 | m_orientation = Qt::Vertical; |
|
944 | m_orientation = Qt::Vertical; | |
945 | break; |
|
945 | break; | |
946 | default: |
|
946 | default: | |
947 | qWarning()<<"No alignment specified !"; |
|
947 | qWarning()<<"No alignment specified !"; | |
948 | break; |
|
948 | break; | |
949 | }; |
|
949 | }; | |
950 | m_alignment=alignment; |
|
950 | m_alignment=alignment; | |
951 | } |
|
951 | } | |
952 |
|
952 | |||
953 | void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced) |
|
953 | void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced) | |
954 | { |
|
954 | { | |
955 | //TODO: introduce axis brush |
|
955 | //TODO: introduce axis brush | |
956 | if (forced || QChartPrivate::defaultPen() == m_axisPen) |
|
956 | if (forced || QChartPrivate::defaultPen() == m_axisPen) | |
957 | q_ptr->setLinePen(theme->axisLinePen()); |
|
957 | q_ptr->setLinePen(theme->axisLinePen()); | |
958 |
|
958 | |||
959 | if (forced || QChartPrivate::defaultPen() == m_gridLinePen) |
|
959 | if (forced || QChartPrivate::defaultPen() == m_gridLinePen) | |
960 | q_ptr->setGridLinePen(theme->girdLinePen()); |
|
960 | q_ptr->setGridLinePen(theme->girdLinePen()); | |
961 |
|
961 | |||
962 | if (forced || QChartPrivate::defaultBrush() == m_labelsBrush) |
|
962 | if (forced || QChartPrivate::defaultBrush() == m_labelsBrush) | |
963 | q_ptr->setLabelsBrush(theme->labelBrush()); |
|
963 | q_ptr->setLabelsBrush(theme->labelBrush()); | |
964 | if (forced || QChartPrivate::defaultPen() == m_labelsPen) |
|
964 | if (forced || QChartPrivate::defaultPen() == m_labelsPen) | |
965 | q_ptr->setLabelsPen(Qt::NoPen); // NoPen for performance reasons |
|
965 | q_ptr->setLabelsPen(Qt::NoPen); // NoPen for performance reasons | |
966 | if (forced || QChartPrivate::defaultFont() == m_labelsFont) |
|
966 | if (forced || QChartPrivate::defaultFont() == m_labelsFont) | |
967 | q_ptr->setLabelsFont(theme->labelFont()); |
|
967 | q_ptr->setLabelsFont(theme->labelFont()); | |
968 |
|
968 | |||
969 | if (forced || QChartPrivate::defaultBrush() == m_titleBrush) |
|
969 | if (forced || QChartPrivate::defaultBrush() == m_titleBrush) | |
970 | q_ptr->setTitleBrush(theme->labelBrush()); |
|
970 | q_ptr->setTitleBrush(theme->labelBrush()); | |
971 | if (forced || QChartPrivate::defaultPen() == m_titlePen) |
|
971 | if (forced || QChartPrivate::defaultPen() == m_titlePen) | |
972 | q_ptr->setTitlePen(Qt::NoPen); // NoPen for performance reasons |
|
972 | q_ptr->setTitlePen(Qt::NoPen); // NoPen for performance reasons | |
973 | if (forced || QChartPrivate::defaultFont() == m_titleFont) { |
|
973 | if (forced || QChartPrivate::defaultFont() == m_titleFont) { | |
974 | QFont font(m_labelsFont); |
|
974 | QFont font(m_labelsFont); | |
975 | font.setBold(true); |
|
975 | font.setBold(true); | |
976 | q_ptr->setTitleFont(font); |
|
976 | q_ptr->setTitleFont(font); | |
977 | } |
|
977 | } | |
978 |
|
978 | |||
979 | if (forced || QChartPrivate::defaultBrush() == m_shadesBrush) |
|
979 | if (forced || QChartPrivate::defaultBrush() == m_shadesBrush) | |
980 | q_ptr->setShadesBrush(theme->backgroundShadesBrush()); |
|
980 | q_ptr->setShadesBrush(theme->backgroundShadesBrush()); | |
981 | if (forced || QChartPrivate::defaultPen() == m_shadesPen) |
|
981 | if (forced || QChartPrivate::defaultPen() == m_shadesPen) | |
982 | q_ptr->setShadesPen(theme->backgroundShadesPen()); |
|
982 | q_ptr->setShadesPen(theme->backgroundShadesPen()); | |
983 |
|
983 | |||
984 | bool axisX = m_orientation == Qt::Horizontal; |
|
984 | bool axisX = m_orientation == Qt::Horizontal; | |
985 | if (forced && (theme->backgroundShades() == ChartTheme::BackgroundShadesBoth |
|
985 | if (forced && (theme->backgroundShades() == ChartTheme::BackgroundShadesBoth | |
986 | || (theme->backgroundShades() == ChartTheme::BackgroundShadesVertical && axisX) |
|
986 | || (theme->backgroundShades() == ChartTheme::BackgroundShadesVertical && axisX) | |
987 | || (theme->backgroundShades() == ChartTheme::BackgroundShadesHorizontal && !axisX))) { |
|
987 | || (theme->backgroundShades() == ChartTheme::BackgroundShadesHorizontal && !axisX))) { | |
988 | q_ptr->setShadesVisible(true); |
|
988 | q_ptr->setShadesVisible(true); | |
989 | } else if (forced) { |
|
989 | } else if (forced) { | |
990 | q_ptr->setShadesVisible(false); |
|
990 | q_ptr->setShadesVisible(false); | |
991 | } |
|
991 | } | |
992 | } |
|
992 | } | |
993 |
|
993 | |||
994 | void QAbstractAxisPrivate::handleRangeChanged(qreal min, qreal max) |
|
994 | void QAbstractAxisPrivate::handleRangeChanged(qreal min, qreal max) | |
995 | { |
|
995 | { | |
996 | setRange(min,max); |
|
996 | setRange(min,max); | |
997 | } |
|
997 | } | |
998 |
|
998 | |||
999 | void QAbstractAxisPrivate::initializeGraphics(QGraphicsItem* parent) |
|
999 | void QAbstractAxisPrivate::initializeGraphics(QGraphicsItem* parent) | |
1000 | { |
|
1000 | { | |
1001 | Q_UNUSED(parent); |
|
1001 | Q_UNUSED(parent); | |
1002 | } |
|
1002 | } | |
1003 |
|
1003 | |||
1004 | void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options) |
|
1004 | void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options) | |
1005 | { |
|
1005 | { | |
1006 | ChartAxisElement *axis = m_item.data(); |
|
1006 | ChartAxisElement *axis = m_item.data(); | |
1007 | Q_ASSERT(axis); |
|
1007 | Q_ASSERT(axis); | |
1008 | if (options.testFlag(QChart::GridAxisAnimations)) { |
|
1008 | if (options.testFlag(QChart::GridAxisAnimations)) { | |
1009 | axis->setAnimation(new AxisAnimation(axis)); |
|
1009 | axis->setAnimation(new AxisAnimation(axis)); | |
1010 | } else { |
|
1010 | } else { | |
1011 | axis->setAnimation(0); |
|
1011 | axis->setAnimation(0); | |
1012 | } |
|
1012 | } | |
1013 | } |
|
1013 | } | |
1014 |
|
1014 | |||
1015 |
|
1015 | |||
1016 |
|
1016 | |||
1017 | #include "moc_qabstractaxis.cpp" |
|
1017 | #include "moc_qabstractaxis.cpp" | |
1018 | #include "moc_qabstractaxis_p.cpp" |
|
1018 | #include "moc_qabstractaxis_p.cpp" | |
1019 |
|
1019 | |||
1020 | QTCOMMERCIALCHART_END_NAMESPACE |
|
1020 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,86 +1,91 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2013 Digia Plc |
|
3 | ** Copyright (C) 2013 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | // W A R N I N G |
|
21 | // W A R N I N G | |
22 | // ------------- |
|
22 | // ------------- | |
23 | // |
|
23 | // | |
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
25 | // implementation detail. This header file may change from version to |
|
25 | // implementation detail. This header file may change from version to | |
26 | // version without notice, or even be removed. |
|
26 | // version without notice, or even be removed. | |
27 | // |
|
27 | // | |
28 | // We mean it. |
|
28 | // We mean it. | |
29 |
|
29 | |||
30 | #ifndef CHARTCONFIG_H |
|
30 | #ifndef CHARTCONFIG_H | |
31 | #define CHARTCONFIG_H |
|
31 | #define CHARTCONFIG_H | |
32 |
|
32 | |||
33 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
34 |
|
34 | |||
35 | #ifdef Q_CC_MSVC |
|
35 | #ifdef Q_CC_MSVC | |
36 | // There is a problem with jom.exe currently. It does not seem to understand QMAKE_EXTRA_TARGETS properly. |
|
36 | // There is a problem with jom.exe currently. It does not seem to understand QMAKE_EXTRA_TARGETS properly. | |
37 | // This is the case at least with shadow builds. |
|
37 | // This is the case at least with shadow builds. | |
38 | // http://qt-project.org/wiki/jom |
|
38 | // http://qt-project.org/wiki/jom | |
39 | #undef DEVELOPMENT_BUILD |
|
39 | #undef DEVELOPMENT_BUILD | |
40 | #endif |
|
40 | #endif | |
41 |
|
41 | |||
42 | #ifndef DEVELOPMENT_BUILD |
|
42 | #ifndef DEVELOPMENT_BUILD | |
|
43 | #ifdef Q_OS_ANDROID | |||
|
44 | // Android builds do not have __DATE__ | |||
|
45 | const char *buildTime = __TIME__; | |||
|
46 | #else | |||
43 | const char *buildTime = __TIME__" "__DATE__; |
|
47 | const char *buildTime = __TIME__" "__DATE__; | |
|
48 | #endif | |||
44 | const char *gitHead = "unknown"; |
|
49 | const char *gitHead = "unknown"; | |
45 | #else |
|
50 | #else | |
46 | #include "qchartversion_p.h" |
|
51 | #include "qchartversion_p.h" | |
47 | #endif |
|
52 | #endif | |
48 |
|
53 | |||
49 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
54 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
50 |
|
55 | |||
51 | class ChartConfig |
|
56 | class ChartConfig | |
52 | { |
|
57 | { | |
53 | private: |
|
58 | private: | |
54 | ChartConfig() { |
|
59 | ChartConfig() { | |
55 | #if defined(DEVELOPMENT_BUILD) && !defined(QT_NO_DEBUG) |
|
60 | #if defined(DEVELOPMENT_BUILD) && !defined(QT_NO_DEBUG) | |
56 | qDebug() << "buildTime" << buildTime; |
|
61 | qDebug() << "buildTime" << buildTime; | |
57 | qDebug() << "gitHead" << gitHead; |
|
62 | qDebug() << "gitHead" << gitHead; | |
58 | #endif |
|
63 | #endif | |
59 | m_instance = this; |
|
64 | m_instance = this; | |
60 | } |
|
65 | } | |
61 | public: |
|
66 | public: | |
62 | static ChartConfig *instance() { |
|
67 | static ChartConfig *instance() { | |
63 | if (!m_instance) { |
|
68 | if (!m_instance) { | |
64 | m_instance = new ChartConfig(); |
|
69 | m_instance = new ChartConfig(); | |
65 | } |
|
70 | } | |
66 | return m_instance; |
|
71 | return m_instance; | |
67 | } |
|
72 | } | |
68 |
|
73 | |||
69 | QString compilationTime() { |
|
74 | QString compilationTime() { | |
70 | return QString(buildTime); |
|
75 | return QString(buildTime); | |
71 | } |
|
76 | } | |
72 |
|
77 | |||
73 | QString compilationHead() { |
|
78 | QString compilationHead() { | |
74 | return QString(gitHead); |
|
79 | return QString(gitHead); | |
75 | } |
|
80 | } | |
76 |
|
81 | |||
77 | private: |
|
82 | private: | |
78 | static ChartConfig *m_instance; |
|
83 | static ChartConfig *m_instance; | |
79 | }; |
|
84 | }; | |
80 |
|
85 | |||
81 |
|
86 | |||
82 | ChartConfig *ChartConfig::m_instance = 0; |
|
87 | ChartConfig *ChartConfig::m_instance = 0; | |
83 |
|
88 | |||
84 | QTCOMMERCIALCHART_END_NAMESPACE |
|
89 | QTCOMMERCIALCHART_END_NAMESPACE | |
85 |
|
90 | |||
86 | #endif |
|
91 | #endif |
@@ -1,91 +1,91 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2013 Digia Plc |
|
3 | ** Copyright (C) 2013 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | // W A R N I N G |
|
21 | // W A R N I N G | |
22 | // ------------- |
|
22 | // ------------- | |
23 | // |
|
23 | // | |
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
25 | // implementation detail. This header file may change from version to |
|
25 | // implementation detail. This header file may change from version to | |
26 | // version without notice, or even be removed. |
|
26 | // version without notice, or even be removed. | |
27 | // |
|
27 | // | |
28 | // We mean it. |
|
28 | // We mean it. | |
29 |
|
29 | |||
30 | #ifndef CHARTTHEME_H |
|
30 | #ifndef CHARTTHEME_H | |
31 | #define CHARTTHEME_H |
|
31 | #define CHARTTHEME_H | |
32 |
|
32 | |||
33 | #include "chartthememanager_p.h" |
|
33 | #include "chartthememanager_p.h" | |
34 | #include <QColor> |
|
34 | #include <QColor> | |
35 | #include <QGradientStops> |
|
35 | #include <QGradientStops> | |
36 |
|
36 | |||
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
38 |
|
38 | |||
39 | class ChartTheme |
|
39 | class ChartTheme | |
40 | { |
|
40 | { | |
41 |
|
41 | |||
42 | public: |
|
42 | public: | |
43 | enum BackgroundShadesMode { |
|
43 | enum BackgroundShadesMode { | |
44 | BackgroundShadesNone = 0, |
|
44 | BackgroundShadesNone = 0, | |
45 | BackgroundShadesVertical, |
|
45 | BackgroundShadesVertical, | |
46 | BackgroundShadesHorizontal, |
|
46 | BackgroundShadesHorizontal, | |
47 | BackgroundShadesBoth |
|
47 | BackgroundShadesBoth | |
48 | }; |
|
48 | }; | |
49 |
|
49 | |||
50 | protected: |
|
50 | protected: | |
51 | explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight):m_id(id), |
|
51 | explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight):m_id(id), | |
52 | m_backgroundShades(BackgroundShadesNone), |
|
|||
53 | m_backgroundShadesBrush(Qt::SolidPattern), |
|
52 | m_backgroundShadesBrush(Qt::SolidPattern), | |
|
53 | m_backgroundShades(BackgroundShadesNone), | |||
54 | m_backgroundDropShadowEnabled(false) |
|
54 | m_backgroundDropShadowEnabled(false) | |
55 | {}; |
|
55 | {}; | |
56 | public: |
|
56 | public: | |
57 | QChart::ChartTheme id() const { return m_id; } |
|
57 | QChart::ChartTheme id() const { return m_id; } | |
58 | QList<QGradient> seriesGradients() const { return m_seriesGradients; } |
|
58 | QList<QGradient> seriesGradients() const { return m_seriesGradients; } | |
59 | QList<QColor> seriesColors() const { return m_seriesColors; } |
|
59 | QList<QColor> seriesColors() const { return m_seriesColors; } | |
60 | QLinearGradient chartBackgroundGradient() const { return m_chartBackgroundGradient; } |
|
60 | QLinearGradient chartBackgroundGradient() const { return m_chartBackgroundGradient; } | |
61 | QFont masterFont() const { return m_masterFont; } |
|
61 | QFont masterFont() const { return m_masterFont; } | |
62 | QFont labelFont() const { return m_labelFont; } |
|
62 | QFont labelFont() const { return m_labelFont; } | |
63 | QBrush labelBrush() const { return m_labelBrush; } |
|
63 | QBrush labelBrush() const { return m_labelBrush; } | |
64 | QPen axisLinePen() const { return m_axisLinePen; } |
|
64 | QPen axisLinePen() const { return m_axisLinePen; } | |
65 | QPen backgroundShadesPen() const { return m_backgroundShadesPen; } |
|
65 | QPen backgroundShadesPen() const { return m_backgroundShadesPen; } | |
66 | QBrush backgroundShadesBrush() const { return m_backgroundShadesBrush; } |
|
66 | QBrush backgroundShadesBrush() const { return m_backgroundShadesBrush; } | |
67 | BackgroundShadesMode backgroundShades() const { return m_backgroundShades; } |
|
67 | BackgroundShadesMode backgroundShades() const { return m_backgroundShades; } | |
68 | bool isBackgroundDropShadowEnabled() const { return m_backgroundDropShadowEnabled; } |
|
68 | bool isBackgroundDropShadowEnabled() const { return m_backgroundDropShadowEnabled; } | |
69 | QPen girdLinePen() const { return m_gridLinePen; } |
|
69 | QPen girdLinePen() const { return m_gridLinePen; } | |
70 |
|
70 | |||
71 | protected: |
|
71 | protected: | |
72 | QChart::ChartTheme m_id; |
|
72 | QChart::ChartTheme m_id; | |
73 | QList<QColor> m_seriesColors; |
|
73 | QList<QColor> m_seriesColors; | |
74 | QList<QGradient> m_seriesGradients; |
|
74 | QList<QGradient> m_seriesGradients; | |
75 | QLinearGradient m_chartBackgroundGradient; |
|
75 | QLinearGradient m_chartBackgroundGradient; | |
76 |
|
76 | |||
77 | QFont m_masterFont; |
|
77 | QFont m_masterFont; | |
78 | QFont m_labelFont; |
|
78 | QFont m_labelFont; | |
79 | QBrush m_labelBrush; |
|
79 | QBrush m_labelBrush; | |
80 | QPen m_axisLinePen; |
|
80 | QPen m_axisLinePen; | |
81 | QPen m_backgroundShadesPen; |
|
81 | QPen m_backgroundShadesPen; | |
82 | QBrush m_backgroundShadesBrush; |
|
82 | QBrush m_backgroundShadesBrush; | |
83 | BackgroundShadesMode m_backgroundShades; |
|
83 | BackgroundShadesMode m_backgroundShades; | |
84 | bool m_backgroundDropShadowEnabled; |
|
84 | bool m_backgroundDropShadowEnabled; | |
85 | QPen m_gridLinePen; |
|
85 | QPen m_gridLinePen; | |
86 |
|
86 | |||
87 | }; |
|
87 | }; | |
88 |
|
88 | |||
89 | QTCOMMERCIALCHART_END_NAMESPACE |
|
89 | QTCOMMERCIALCHART_END_NAMESPACE | |
90 |
|
90 | |||
91 | #endif // CHARTTHEME_H |
|
91 | #endif // CHARTTHEME_H |
@@ -1,1199 +1,1199 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2013 Digia Plc |
|
3 | ** Copyright (C) 2013 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "mainwindow.h" |
|
21 | #include "mainwindow.h" | |
22 | #include "chartview.h" |
|
22 | #include "chartview.h" | |
23 | #include <QScatterSeries> |
|
23 | #include <QScatterSeries> | |
24 | #include <QLineSeries> |
|
24 | #include <QLineSeries> | |
25 | #include <QSplineSeries> |
|
25 | #include <QSplineSeries> | |
26 | #include <QAreaSeries> |
|
26 | #include <QAreaSeries> | |
27 | #include <QBarSeries> |
|
27 | #include <QBarSeries> | |
28 | #include <QBarSet> |
|
28 | #include <QBarSet> | |
29 | #include <QValueAxis> |
|
29 | #include <QValueAxis> | |
30 | #include <QLogValueAxis> |
|
30 | #include <QLogValueAxis> | |
31 | #include <QDateTimeAxis> |
|
31 | #include <QDateTimeAxis> | |
32 | #include <QCategoryAxis> |
|
32 | #include <QCategoryAxis> | |
33 | #include <QPolarChart> |
|
33 | #include <QPolarChart> | |
34 | #include <QDebug> |
|
34 | #include <QDebug> | |
35 | #include <qmath.h> |
|
35 | #include <qmath.h> | |
36 | #include <QDateTime> |
|
36 | #include <QDateTime> | |
37 |
|
37 | |||
38 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
38 | QTCOMMERCIALCHART_USE_NAMESPACE | |
39 | #include "ui_mainwindow.h" |
|
39 | #include "ui_mainwindow.h" | |
40 |
|
40 | |||
41 | MainWindow::MainWindow(QWidget *parent) : |
|
41 | MainWindow::MainWindow(QWidget *parent) : | |
42 | QMainWindow(parent), |
|
42 | QMainWindow(parent), | |
43 | ui(new Ui::MainWindow), |
|
43 | ui(new Ui::MainWindow), | |
44 | m_angularTickCount(9), |
|
44 | m_angularTickCount(9), | |
45 | m_radialTickCount(11), |
|
45 | m_radialTickCount(11), | |
46 | m_labelsAngle(0), |
|
46 | m_labelsAngle(0), | |
47 | m_angularMin(0.0), |
|
47 | m_angularMin(0.0), | |
48 | m_angularMax(40000.0), |
|
48 | m_angularMax(40000.0), | |
49 | m_radialMin(0.0), |
|
49 | m_radialMin(0.0), | |
50 | m_radialMax(30000.0), |
|
50 | m_radialMax(30000.0), | |
51 | m_angularShadesVisible(false), |
|
51 | m_angularShadesVisible(false), | |
52 | m_radialShadesVisible(false), |
|
52 | m_radialShadesVisible(false), | |
53 | m_labelsVisible(true), |
|
53 | m_labelsVisible(true), | |
54 | m_titleVisible(true), |
|
54 | m_titleVisible(true), | |
55 | m_gridVisible(true), |
|
55 | m_gridVisible(true), | |
56 | m_arrowVisible(true), |
|
56 | m_arrowVisible(true), | |
57 | m_angularShadesBrush(new QBrush(Qt::NoBrush)), |
|
57 | m_angularShadesBrush(new QBrush(Qt::NoBrush)), | |
58 | m_radialShadesBrush(new QBrush(Qt::NoBrush)), |
|
58 | m_radialShadesBrush(new QBrush(Qt::NoBrush)), | |
59 | m_labelBrush(new QBrush(Qt::black)), |
|
59 | m_labelBrush(new QBrush(Qt::black)), | |
60 | m_titleBrush(new QBrush(Qt::black)), |
|
60 | m_titleBrush(new QBrush(Qt::black)), | |
61 | m_backgroundBrush(new QBrush(Qt::white)), |
|
61 | m_backgroundBrush(new QBrush(Qt::white)), | |
62 | m_plotAreaBackgroundBrush(new QBrush(Qt::NoBrush)), |
|
62 | m_plotAreaBackgroundBrush(new QBrush(Qt::NoBrush)), | |
63 | m_angularShadesPen(new QPen(Qt::NoPen)), |
|
63 | m_angularShadesPen(new QPen(Qt::NoPen)), | |
64 | m_radialShadesPen(new QPen(Qt::NoPen)), |
|
64 | m_radialShadesPen(new QPen(Qt::NoPen)), | |
65 | m_labelPen(new QPen(Qt::NoPen)), |
|
65 | m_labelPen(new QPen(Qt::NoPen)), | |
66 | m_titlePen(new QPen(Qt::NoPen)), |
|
66 | m_titlePen(new QPen(Qt::NoPen)), | |
67 | m_gridPen(new QPen(QRgb(0x010101))), // Note: Pure black is default color, so it gets overridden by |
|
67 | m_gridPen(new QPen(QRgb(0x010101))), // Note: Pure black is default color, so it gets overridden by | |
68 | m_arrowPen(new QPen(QRgb(0x010101))), // default theme if set to that initially. This is an example of workaround. |
|
68 | m_arrowPen(new QPen(QRgb(0x010101))), // default theme if set to that initially. This is an example of workaround. | |
69 | m_backgroundPen(new QPen(Qt::NoPen)), |
|
69 | m_backgroundPen(new QPen(Qt::NoPen)), | |
70 | m_plotAreaBackgroundPen(new QPen(Qt::NoPen)), |
|
70 | m_plotAreaBackgroundPen(new QPen(Qt::NoPen)), | |
71 | m_labelFormat(QString("%.2f")), |
|
71 | m_labelFormat(QString("%.2f")), | |
72 | m_animationOptions(QChart::NoAnimation), |
|
72 | m_animationOptions(QChart::NoAnimation), | |
73 | m_angularTitle(QString("Angular Title")), |
|
73 | m_angularTitle(QString("Angular Title")), | |
74 | m_radialTitle(QString("Radial Title")), |
|
74 | m_radialTitle(QString("Radial Title")), | |
75 | m_base(2.0), |
|
75 | m_base(2.0), | |
|
76 | m_dateFormat(QString("mm-ss-zzz")), | |||
76 | m_chart(0), |
|
77 | m_chart(0), | |
77 | m_angularAxis(0), |
|
78 | m_angularAxis(0), | |
78 | m_radialAxis(0), |
|
79 | m_radialAxis(0), | |
79 | m_angularAxisMode(AxisModeNone), |
|
80 | m_angularAxisMode(AxisModeNone), | |
80 | m_radialAxisMode(AxisModeNone), |
|
81 | m_radialAxisMode(AxisModeNone), | |
|
82 | m_moreCategories(false), | |||
81 | m_series1(0), |
|
83 | m_series1(0), | |
82 | m_series2(0), |
|
84 | m_series2(0), | |
83 | m_series3(0), |
|
85 | m_series3(0), | |
84 | m_series4(0), |
|
86 | m_series4(0), | |
85 | m_series5(0), |
|
87 | m_series5(0), | |
86 | m_series6(0), |
|
88 | m_series6(0), | |
87 |
m_series7(0) |
|
89 | m_series7(0) | |
88 | m_dateFormat(QString("mm-ss-zzz")), |
|
|||
89 | m_moreCategories(false) |
|
|||
90 | { |
|
90 | { | |
91 | ui->setupUi(this); |
|
91 | ui->setupUi(this); | |
92 |
|
92 | |||
93 | ui->angularTicksSpin->setValue(m_angularTickCount); |
|
93 | ui->angularTicksSpin->setValue(m_angularTickCount); | |
94 | ui->radialTicksSpin->setValue(m_radialTickCount); |
|
94 | ui->radialTicksSpin->setValue(m_radialTickCount); | |
95 | ui->anglesSpin->setValue(m_labelsAngle); |
|
95 | ui->anglesSpin->setValue(m_labelsAngle); | |
96 | ui->radialMinSpin->setValue(m_radialMin); |
|
96 | ui->radialMinSpin->setValue(m_radialMin); | |
97 | ui->radialMaxSpin->setValue(m_radialMax); |
|
97 | ui->radialMaxSpin->setValue(m_radialMax); | |
98 | ui->angularMinSpin->setValue(m_angularMin); |
|
98 | ui->angularMinSpin->setValue(m_angularMin); | |
99 | ui->angularMaxSpin->setValue(m_angularMax); |
|
99 | ui->angularMaxSpin->setValue(m_angularMax); | |
100 | ui->angularShadesComboBox->setCurrentIndex(0); |
|
100 | ui->angularShadesComboBox->setCurrentIndex(0); | |
101 | ui->radialShadesComboBox->setCurrentIndex(0); |
|
101 | ui->radialShadesComboBox->setCurrentIndex(0); | |
102 | ui->labelFormatEdit->setText(m_labelFormat); |
|
102 | ui->labelFormatEdit->setText(m_labelFormat); | |
103 | ui->dateFormatEdit->setText(m_dateFormat); |
|
103 | ui->dateFormatEdit->setText(m_dateFormat); | |
104 | ui->moreCategoriesCheckBox->setChecked(m_moreCategories); |
|
104 | ui->moreCategoriesCheckBox->setChecked(m_moreCategories); | |
105 |
|
105 | |||
106 | ui->series1checkBox->setChecked(true); |
|
106 | ui->series1checkBox->setChecked(true); | |
107 | ui->series2checkBox->setChecked(true); |
|
107 | ui->series2checkBox->setChecked(true); | |
108 | ui->series3checkBox->setChecked(true); |
|
108 | ui->series3checkBox->setChecked(true); | |
109 | ui->series4checkBox->setChecked(true); |
|
109 | ui->series4checkBox->setChecked(true); | |
110 | ui->series5checkBox->setChecked(true); |
|
110 | ui->series5checkBox->setChecked(true); | |
111 | ui->series6checkBox->setChecked(true); |
|
111 | ui->series6checkBox->setChecked(true); | |
112 | ui->series7checkBox->setChecked(true); |
|
112 | ui->series7checkBox->setChecked(true); | |
113 |
|
113 | |||
114 | m_currentLabelFont.setFamily(ui->labelFontComboBox->currentFont().family()); |
|
114 | m_currentLabelFont.setFamily(ui->labelFontComboBox->currentFont().family()); | |
115 | m_currentLabelFont.setPixelSize(15); |
|
115 | m_currentLabelFont.setPixelSize(15); | |
116 | m_currentTitleFont.setFamily(ui->titleFontComboBox->currentFont().family()); |
|
116 | m_currentTitleFont.setFamily(ui->titleFontComboBox->currentFont().family()); | |
117 | m_currentTitleFont.setPixelSize(30); |
|
117 | m_currentTitleFont.setPixelSize(30); | |
118 |
|
118 | |||
119 | ui->labelFontSizeSpin->setValue(m_currentLabelFont.pixelSize()); |
|
119 | ui->labelFontSizeSpin->setValue(m_currentLabelFont.pixelSize()); | |
120 | ui->titleFontSizeSpin->setValue(m_currentTitleFont.pixelSize()); |
|
120 | ui->titleFontSizeSpin->setValue(m_currentTitleFont.pixelSize()); | |
121 |
|
121 | |||
122 | ui->logBaseSpin->setValue(m_base); |
|
122 | ui->logBaseSpin->setValue(m_base); | |
123 |
|
123 | |||
124 | initXYValueChart(); |
|
124 | initXYValueChart(); | |
125 | setAngularAxis(AxisModeValue); |
|
125 | setAngularAxis(AxisModeValue); | |
126 | setRadialAxis(AxisModeValue); |
|
126 | setRadialAxis(AxisModeValue); | |
127 |
|
127 | |||
128 | ui->angularAxisComboBox->setCurrentIndex(int(m_angularAxisMode)); |
|
128 | ui->angularAxisComboBox->setCurrentIndex(int(m_angularAxisMode)); | |
129 | ui->radialAxisComboBox->setCurrentIndex(int(m_radialAxisMode)); |
|
129 | ui->radialAxisComboBox->setCurrentIndex(int(m_radialAxisMode)); | |
130 |
|
130 | |||
131 | connect(ui->angularTicksSpin, SIGNAL(valueChanged(int)), this, SLOT(angularTicksChanged(int))); |
|
131 | connect(ui->angularTicksSpin, SIGNAL(valueChanged(int)), this, SLOT(angularTicksChanged(int))); | |
132 | connect(ui->radialTicksSpin, SIGNAL(valueChanged(int)), this, SLOT(radialTicksChanged(int))); |
|
132 | connect(ui->radialTicksSpin, SIGNAL(valueChanged(int)), this, SLOT(radialTicksChanged(int))); | |
133 | connect(ui->anglesSpin, SIGNAL(valueChanged(int)), this, SLOT(anglesChanged(int))); |
|
133 | connect(ui->anglesSpin, SIGNAL(valueChanged(int)), this, SLOT(anglesChanged(int))); | |
134 | connect(ui->radialMinSpin, SIGNAL(valueChanged(double)), this, SLOT(radialMinChanged(double))); |
|
134 | connect(ui->radialMinSpin, SIGNAL(valueChanged(double)), this, SLOT(radialMinChanged(double))); | |
135 | connect(ui->radialMaxSpin, SIGNAL(valueChanged(double)), this, SLOT(radialMaxChanged(double))); |
|
135 | connect(ui->radialMaxSpin, SIGNAL(valueChanged(double)), this, SLOT(radialMaxChanged(double))); | |
136 | connect(ui->angularMinSpin, SIGNAL(valueChanged(double)), this, SLOT(angularMinChanged(double))); |
|
136 | connect(ui->angularMinSpin, SIGNAL(valueChanged(double)), this, SLOT(angularMinChanged(double))); | |
137 | connect(ui->angularMaxSpin, SIGNAL(valueChanged(double)), this, SLOT(angularMaxChanged(double))); |
|
137 | connect(ui->angularMaxSpin, SIGNAL(valueChanged(double)), this, SLOT(angularMaxChanged(double))); | |
138 | connect(ui->angularShadesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(angularShadesIndexChanged(int))); |
|
138 | connect(ui->angularShadesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(angularShadesIndexChanged(int))); | |
139 | connect(ui->radialShadesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(radialShadesIndexChanged(int))); |
|
139 | connect(ui->radialShadesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(radialShadesIndexChanged(int))); | |
140 | connect(ui->animationsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(animationIndexChanged(int))); |
|
140 | connect(ui->animationsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(animationIndexChanged(int))); | |
141 | connect(ui->labelFormatEdit, SIGNAL(textEdited(QString)), this, SLOT(labelFormatEdited(QString))); |
|
141 | connect(ui->labelFormatEdit, SIGNAL(textEdited(QString)), this, SLOT(labelFormatEdited(QString))); | |
142 | connect(ui->labelFontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(labelFontChanged(QFont))); |
|
142 | connect(ui->labelFontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(labelFontChanged(QFont))); | |
143 | connect(ui->labelFontSizeSpin, SIGNAL(valueChanged(int)), this, SLOT(labelFontSizeChanged(int))); |
|
143 | connect(ui->labelFontSizeSpin, SIGNAL(valueChanged(int)), this, SLOT(labelFontSizeChanged(int))); | |
144 | connect(ui->labelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(labelsIndexChanged(int))); |
|
144 | connect(ui->labelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(labelsIndexChanged(int))); | |
145 | connect(ui->titleFontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(titleFontChanged(QFont))); |
|
145 | connect(ui->titleFontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(titleFontChanged(QFont))); | |
146 | connect(ui->titleFontSizeSpin, SIGNAL(valueChanged(int)), this, SLOT(titleFontSizeChanged(int))); |
|
146 | connect(ui->titleFontSizeSpin, SIGNAL(valueChanged(int)), this, SLOT(titleFontSizeChanged(int))); | |
147 | connect(ui->titleComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(titleIndexChanged(int))); |
|
147 | connect(ui->titleComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(titleIndexChanged(int))); | |
148 | connect(ui->gridComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(gridIndexChanged(int))); |
|
148 | connect(ui->gridComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(gridIndexChanged(int))); | |
149 | connect(ui->arrowComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(arrowIndexChanged(int))); |
|
149 | connect(ui->arrowComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(arrowIndexChanged(int))); | |
150 | connect(ui->logBaseSpin, SIGNAL(valueChanged(double)), this, SLOT(logBaseChanged(double))); |
|
150 | connect(ui->logBaseSpin, SIGNAL(valueChanged(double)), this, SLOT(logBaseChanged(double))); | |
151 | connect(ui->angularAxisComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(angularAxisIndexChanged(int))); |
|
151 | connect(ui->angularAxisComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(angularAxisIndexChanged(int))); | |
152 | connect(ui->radialAxisComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(radialAxisIndexChanged(int))); |
|
152 | connect(ui->radialAxisComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(radialAxisIndexChanged(int))); | |
153 | connect(ui->niceNumbersCheckBox, SIGNAL(clicked()), this, SLOT(niceNumbersChecked())); |
|
153 | connect(ui->niceNumbersCheckBox, SIGNAL(clicked()), this, SLOT(niceNumbersChecked())); | |
154 | connect(ui->dateFormatEdit, SIGNAL(textEdited(QString)), this, SLOT(dateFormatEdited(QString))); |
|
154 | connect(ui->dateFormatEdit, SIGNAL(textEdited(QString)), this, SLOT(dateFormatEdited(QString))); | |
155 | connect(ui->moreCategoriesCheckBox, SIGNAL(clicked()), this, SLOT(moreCategoriesChecked())); |
|
155 | connect(ui->moreCategoriesCheckBox, SIGNAL(clicked()), this, SLOT(moreCategoriesChecked())); | |
156 | connect(ui->series1checkBox, SIGNAL(clicked()), this, SLOT(series1CheckBoxChecked())); |
|
156 | connect(ui->series1checkBox, SIGNAL(clicked()), this, SLOT(series1CheckBoxChecked())); | |
157 | connect(ui->series2checkBox, SIGNAL(clicked()), this, SLOT(series2CheckBoxChecked())); |
|
157 | connect(ui->series2checkBox, SIGNAL(clicked()), this, SLOT(series2CheckBoxChecked())); | |
158 | connect(ui->series3checkBox, SIGNAL(clicked()), this, SLOT(series3CheckBoxChecked())); |
|
158 | connect(ui->series3checkBox, SIGNAL(clicked()), this, SLOT(series3CheckBoxChecked())); | |
159 | connect(ui->series4checkBox, SIGNAL(clicked()), this, SLOT(series4CheckBoxChecked())); |
|
159 | connect(ui->series4checkBox, SIGNAL(clicked()), this, SLOT(series4CheckBoxChecked())); | |
160 | connect(ui->series5checkBox, SIGNAL(clicked()), this, SLOT(series5CheckBoxChecked())); |
|
160 | connect(ui->series5checkBox, SIGNAL(clicked()), this, SLOT(series5CheckBoxChecked())); | |
161 | connect(ui->series6checkBox, SIGNAL(clicked()), this, SLOT(series6CheckBoxChecked())); |
|
161 | connect(ui->series6checkBox, SIGNAL(clicked()), this, SLOT(series6CheckBoxChecked())); | |
162 | connect(ui->series7checkBox, SIGNAL(clicked()), this, SLOT(series7CheckBoxChecked())); |
|
162 | connect(ui->series7checkBox, SIGNAL(clicked()), this, SLOT(series7CheckBoxChecked())); | |
163 | connect(ui->themeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(themeIndexChanged(int))); |
|
163 | connect(ui->themeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(themeIndexChanged(int))); | |
164 | connect(ui->backgroundComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundIndexChanged(int))); |
|
164 | connect(ui->backgroundComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundIndexChanged(int))); | |
165 | connect(ui->plotAreaComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(plotAreaIndexChanged(int))); |
|
165 | connect(ui->plotAreaComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(plotAreaIndexChanged(int))); | |
166 |
|
166 | |||
167 | ui->chartView->setChart(m_chart); |
|
167 | ui->chartView->setChart(m_chart); | |
168 | ui->chartView->setRenderHint(QPainter::Antialiasing); |
|
168 | ui->chartView->setRenderHint(QPainter::Antialiasing); | |
169 | } |
|
169 | } | |
170 |
|
170 | |||
171 | MainWindow::~MainWindow() |
|
171 | MainWindow::~MainWindow() | |
172 | { |
|
172 | { | |
173 | delete ui; |
|
173 | delete ui; | |
174 | delete m_angularShadesBrush; |
|
174 | delete m_angularShadesBrush; | |
175 | delete m_radialShadesBrush; |
|
175 | delete m_radialShadesBrush; | |
176 | delete m_angularShadesPen; |
|
176 | delete m_angularShadesPen; | |
177 | delete m_radialShadesPen; |
|
177 | delete m_radialShadesPen; | |
178 | } |
|
178 | } | |
179 |
|
179 | |||
180 | void MainWindow::initXYValueChart() |
|
180 | void MainWindow::initXYValueChart() | |
181 | { |
|
181 | { | |
182 | qreal seriesAngularMin = 1; |
|
182 | qreal seriesAngularMin = 1; | |
183 | qreal seriesAngularMax = 46000; |
|
183 | qreal seriesAngularMax = 46000; | |
184 | qreal seriesRadialMin = 1; |
|
184 | qreal seriesRadialMin = 1; | |
185 | qreal seriesRadialMax = 23500; |
|
185 | qreal seriesRadialMax = 23500; | |
186 | qreal radialDimension = seriesRadialMax - seriesRadialMin; |
|
186 | qreal radialDimension = seriesRadialMax - seriesRadialMin; | |
187 | qreal angularDimension = seriesAngularMax - seriesAngularMin; |
|
187 | qreal angularDimension = seriesAngularMax - seriesAngularMin; | |
188 |
|
188 | |||
189 | // Scatter series, points outside min-max ranges should not be drawn |
|
189 | // Scatter series, points outside min-max ranges should not be drawn | |
190 | m_series1 = new QScatterSeries(); |
|
190 | m_series1 = new QScatterSeries(); | |
191 | m_series1->setName("scatter"); |
|
191 | m_series1->setName("scatter"); | |
192 | qreal scatterCount = 10; |
|
192 | qreal scatterCount = 10; | |
193 | qreal scatterAngularStep = angularDimension / scatterCount; |
|
193 | qreal scatterAngularStep = angularDimension / scatterCount; | |
194 | qreal scatterRadialStep = radialDimension / scatterCount; |
|
194 | qreal scatterRadialStep = radialDimension / scatterCount; | |
195 | for (qreal i = 0.0; i < scatterCount; i++) { |
|
195 | for (qreal i = 0.0; i < scatterCount; i++) { | |
196 | m_series1->append((i * scatterAngularStep) + seriesAngularMin, (i * scatterRadialStep) + seriesRadialMin); |
|
196 | m_series1->append((i * scatterAngularStep) + seriesAngularMin, (i * scatterRadialStep) + seriesRadialMin); | |
197 | //qDebug() << m_series1->points().last(); |
|
197 | //qDebug() << m_series1->points().last(); | |
198 | } |
|
198 | } | |
199 | m_series1->setMarkerSize(10); |
|
199 | m_series1->setMarkerSize(10); | |
200 | *m_series1 << QPointF(50, 50) << QPointF(150, 150) << QPointF(250, 250) << QPointF(350, 350) << QPointF(450, 450); |
|
200 | *m_series1 << QPointF(50, 50) << QPointF(150, 150) << QPointF(250, 250) << QPointF(350, 350) << QPointF(450, 450); | |
201 | *m_series1 << QPointF(1050, 0.50) << QPointF(1150, 0.25) << QPointF(1250, 0.12) << QPointF(1350, 0.075) << QPointF(1450, 0.036); |
|
201 | *m_series1 << QPointF(1050, 0.50) << QPointF(1150, 0.25) << QPointF(1250, 0.12) << QPointF(1350, 0.075) << QPointF(1450, 0.036); | |
202 | *m_series1 << QPointF(0.50, 2000) << QPointF(0.25, 3500) << QPointF(0.12, 5000) << QPointF(0.075, 6500) << QPointF(0.036, 8000); |
|
202 | *m_series1 << QPointF(0.50, 2000) << QPointF(0.25, 3500) << QPointF(0.12, 5000) << QPointF(0.075, 6500) << QPointF(0.036, 8000); | |
203 |
|
203 | |||
204 | // Line series, points outside min-max ranges should not be drawn, |
|
204 | // Line series, points outside min-max ranges should not be drawn, | |
205 | // but lines should be properly interpolated at chart edges |
|
205 | // but lines should be properly interpolated at chart edges | |
206 | m_series2 = new QLineSeries(); |
|
206 | m_series2 = new QLineSeries(); | |
207 | m_series2->setName("line 1"); |
|
207 | m_series2->setName("line 1"); | |
208 | qreal lineCount = 100; |
|
208 | qreal lineCount = 100; | |
209 | qreal lineAngularStep = angularDimension / lineCount; |
|
209 | qreal lineAngularStep = angularDimension / lineCount; | |
210 | qreal lineRadialStep = radialDimension / lineCount; |
|
210 | qreal lineRadialStep = radialDimension / lineCount; | |
211 | for (qreal i = 0.0; i < lineCount; i++) { |
|
211 | for (qreal i = 0.0; i < lineCount; i++) { | |
212 | m_series2->append((i * lineAngularStep) + seriesAngularMin, (i * lineRadialStep) + seriesRadialMin); |
|
212 | m_series2->append((i * lineAngularStep) + seriesAngularMin, (i * lineRadialStep) + seriesRadialMin); | |
213 | //qDebug() << m_series2->points().last(); |
|
213 | //qDebug() << m_series2->points().last(); | |
214 | } |
|
214 | } | |
215 | QPen series2Pen = QPen(Qt::blue, 10); |
|
215 | QPen series2Pen = QPen(Qt::blue, 10); | |
216 | //series2Pen.setStyle(Qt::DashDotDotLine); |
|
216 | //series2Pen.setStyle(Qt::DashDotDotLine); | |
217 | m_series2->setPen(series2Pen); |
|
217 | m_series2->setPen(series2Pen); | |
218 |
|
218 | |||
219 | m_series3 = new QLineSeries(); |
|
219 | m_series3 = new QLineSeries(); | |
220 | m_series3->setName("Area upper"); |
|
220 | m_series3->setName("Area upper"); | |
221 | lineCount = 87; |
|
221 | lineCount = 87; | |
222 | lineAngularStep = angularDimension / lineCount; |
|
222 | lineAngularStep = angularDimension / lineCount; | |
223 | lineRadialStep = radialDimension / lineCount; |
|
223 | lineRadialStep = radialDimension / lineCount; | |
224 | for (qreal i = 1.0; i <= lineCount; i++) { |
|
224 | for (qreal i = 1.0; i <= lineCount; i++) { | |
225 | m_series3->append((i * lineAngularStep) + seriesAngularMin, (i * lineRadialStep) + seriesRadialMin + 200.0); |
|
225 | m_series3->append((i * lineAngularStep) + seriesAngularMin, (i * lineRadialStep) + seriesRadialMin + 200.0); | |
226 | //qDebug() << m_series3->points().last(); |
|
226 | //qDebug() << m_series3->points().last(); | |
227 | } |
|
227 | } | |
228 |
|
228 | |||
229 | m_series4 = new QLineSeries(); |
|
229 | m_series4 = new QLineSeries(); | |
230 | m_series4->setName("Area lower"); |
|
230 | m_series4->setName("Area lower"); | |
231 | lineCount = 89; |
|
231 | lineCount = 89; | |
232 | lineAngularStep = angularDimension / lineCount; |
|
232 | lineAngularStep = angularDimension / lineCount; | |
233 | lineRadialStep = radialDimension / lineCount; |
|
233 | lineRadialStep = radialDimension / lineCount; | |
234 | for (qreal i = 1.0; i <= lineCount; i++) { |
|
234 | for (qreal i = 1.0; i <= lineCount; i++) { | |
235 | m_series4->append((i * lineAngularStep) + seriesAngularMin + 100.0, (i * lineRadialStep) + seriesRadialMin + i * 300.0); |
|
235 | m_series4->append((i * lineAngularStep) + seriesAngularMin + 100.0, (i * lineRadialStep) + seriesRadialMin + i * 300.0); | |
236 | //qDebug() << m_series4->points().last(); |
|
236 | //qDebug() << m_series4->points().last(); | |
237 | } |
|
237 | } | |
238 |
|
238 | |||
239 | m_series5 = new QAreaSeries(); |
|
239 | m_series5 = new QAreaSeries(); | |
240 | m_series5->setName("area"); |
|
240 | m_series5->setName("area"); | |
241 | m_series5->setUpperSeries(m_series3); |
|
241 | m_series5->setUpperSeries(m_series3); | |
242 | m_series5->setLowerSeries(m_series4); |
|
242 | m_series5->setLowerSeries(m_series4); | |
243 | m_series5->setOpacity(0.5); |
|
243 | m_series5->setOpacity(0.5); | |
244 |
|
244 | |||
245 | m_series6 = new QSplineSeries(); |
|
245 | m_series6 = new QSplineSeries(); | |
246 | m_series6->setName("spline"); |
|
246 | m_series6->setName("spline"); | |
247 | qreal ad = angularDimension / 20; |
|
247 | qreal ad = angularDimension / 20; | |
248 | qreal rd = radialDimension / 10; |
|
248 | qreal rd = radialDimension / 10; | |
249 | m_series6->append(seriesAngularMin, seriesRadialMin + rd * 2); |
|
249 | m_series6->append(seriesAngularMin, seriesRadialMin + rd * 2); | |
250 | m_series6->append(seriesAngularMin + ad, seriesRadialMin + rd * 5); |
|
250 | m_series6->append(seriesAngularMin + ad, seriesRadialMin + rd * 5); | |
251 | m_series6->append(seriesAngularMin + ad * 2, seriesRadialMin + rd * 4); |
|
251 | m_series6->append(seriesAngularMin + ad * 2, seriesRadialMin + rd * 4); | |
252 | m_series6->append(seriesAngularMin + ad * 3, seriesRadialMin + rd * 9); |
|
252 | m_series6->append(seriesAngularMin + ad * 3, seriesRadialMin + rd * 9); | |
253 | m_series6->append(seriesAngularMin + ad * 4, seriesRadialMin + rd * 11); |
|
253 | m_series6->append(seriesAngularMin + ad * 4, seriesRadialMin + rd * 11); | |
254 | m_series6->append(seriesAngularMin + ad * 5, seriesRadialMin + rd * 12); |
|
254 | m_series6->append(seriesAngularMin + ad * 5, seriesRadialMin + rd * 12); | |
255 | m_series6->append(seriesAngularMin + ad * 6, seriesRadialMin + rd * 9); |
|
255 | m_series6->append(seriesAngularMin + ad * 6, seriesRadialMin + rd * 9); | |
256 | m_series6->append(seriesAngularMin + ad * 7, seriesRadialMin + rd * 11); |
|
256 | m_series6->append(seriesAngularMin + ad * 7, seriesRadialMin + rd * 11); | |
257 | m_series6->append(seriesAngularMin + ad * 8, seriesRadialMin + rd * 12); |
|
257 | m_series6->append(seriesAngularMin + ad * 8, seriesRadialMin + rd * 12); | |
258 | m_series6->append(seriesAngularMin + ad * 9, seriesRadialMin + rd * 6); |
|
258 | m_series6->append(seriesAngularMin + ad * 9, seriesRadialMin + rd * 6); | |
259 | m_series6->append(seriesAngularMin + ad * 10, seriesRadialMin + rd * 4); |
|
259 | m_series6->append(seriesAngularMin + ad * 10, seriesRadialMin + rd * 4); | |
260 | m_series6->append(seriesAngularMin + ad * 10, seriesRadialMin + rd * 8); |
|
260 | m_series6->append(seriesAngularMin + ad * 10, seriesRadialMin + rd * 8); | |
261 | m_series6->append(seriesAngularMin + ad * 11, seriesRadialMin + rd * 9); |
|
261 | m_series6->append(seriesAngularMin + ad * 11, seriesRadialMin + rd * 9); | |
262 | m_series6->append(seriesAngularMin + ad * 12, seriesRadialMin + rd * 11); |
|
262 | m_series6->append(seriesAngularMin + ad * 12, seriesRadialMin + rd * 11); | |
263 | m_series6->append(seriesAngularMin + ad * 13, seriesRadialMin + rd * 12); |
|
263 | m_series6->append(seriesAngularMin + ad * 13, seriesRadialMin + rd * 12); | |
264 | m_series6->append(seriesAngularMin + ad * 14, seriesRadialMin + rd * 6); |
|
264 | m_series6->append(seriesAngularMin + ad * 14, seriesRadialMin + rd * 6); | |
265 | m_series6->append(seriesAngularMin + ad * 15, seriesRadialMin + rd * 3); |
|
265 | m_series6->append(seriesAngularMin + ad * 15, seriesRadialMin + rd * 3); | |
266 | m_series6->append(seriesAngularMin + ad * 16, seriesRadialMin + rd * 2); |
|
266 | m_series6->append(seriesAngularMin + ad * 16, seriesRadialMin + rd * 2); | |
267 | m_series6->append(seriesAngularMin + ad * 17, seriesRadialMin + rd * 6); |
|
267 | m_series6->append(seriesAngularMin + ad * 17, seriesRadialMin + rd * 6); | |
268 | m_series6->append(seriesAngularMin + ad * 18, seriesRadialMin + rd * 6); |
|
268 | m_series6->append(seriesAngularMin + ad * 18, seriesRadialMin + rd * 6); | |
269 | m_series6->append(seriesAngularMin + ad * 19, seriesRadialMin + rd * 6); |
|
269 | m_series6->append(seriesAngularMin + ad * 19, seriesRadialMin + rd * 6); | |
270 | m_series6->append(seriesAngularMin + ad * 20, seriesRadialMin + rd * 6); |
|
270 | m_series6->append(seriesAngularMin + ad * 20, seriesRadialMin + rd * 6); | |
271 | m_series6->append(seriesAngularMin + ad * 19, seriesRadialMin + rd * 2); |
|
271 | m_series6->append(seriesAngularMin + ad * 19, seriesRadialMin + rd * 2); | |
272 | m_series6->append(seriesAngularMin + ad * 18, seriesRadialMin + rd * 9); |
|
272 | m_series6->append(seriesAngularMin + ad * 18, seriesRadialMin + rd * 9); | |
273 | m_series6->append(seriesAngularMin + ad * 17, seriesRadialMin + rd * 7); |
|
273 | m_series6->append(seriesAngularMin + ad * 17, seriesRadialMin + rd * 7); | |
274 | m_series6->append(seriesAngularMin + ad * 16, seriesRadialMin + rd * 3); |
|
274 | m_series6->append(seriesAngularMin + ad * 16, seriesRadialMin + rd * 3); | |
275 | m_series6->append(seriesAngularMin + ad * 15, seriesRadialMin + rd * 1); |
|
275 | m_series6->append(seriesAngularMin + ad * 15, seriesRadialMin + rd * 1); | |
276 | m_series6->append(seriesAngularMin + ad * 14, seriesRadialMin + rd * 7); |
|
276 | m_series6->append(seriesAngularMin + ad * 14, seriesRadialMin + rd * 7); | |
277 | m_series6->append(seriesAngularMin + ad * 13, seriesRadialMin + rd * 5); |
|
277 | m_series6->append(seriesAngularMin + ad * 13, seriesRadialMin + rd * 5); | |
278 | m_series6->append(seriesAngularMin + ad * 12, seriesRadialMin + rd * 9); |
|
278 | m_series6->append(seriesAngularMin + ad * 12, seriesRadialMin + rd * 9); | |
279 | m_series6->append(seriesAngularMin + ad * 11, seriesRadialMin + rd * 1); |
|
279 | m_series6->append(seriesAngularMin + ad * 11, seriesRadialMin + rd * 1); | |
280 | m_series6->append(seriesAngularMin + ad * 10, seriesRadialMin + rd * 4); |
|
280 | m_series6->append(seriesAngularMin + ad * 10, seriesRadialMin + rd * 4); | |
281 | m_series6->append(seriesAngularMin + ad * 9, seriesRadialMin + rd * 1); |
|
281 | m_series6->append(seriesAngularMin + ad * 9, seriesRadialMin + rd * 1); | |
282 | m_series6->append(seriesAngularMin + ad * 8, seriesRadialMin + rd * 2); |
|
282 | m_series6->append(seriesAngularMin + ad * 8, seriesRadialMin + rd * 2); | |
283 | m_series6->append(seriesAngularMin + ad * 7, seriesRadialMin + rd * 4); |
|
283 | m_series6->append(seriesAngularMin + ad * 7, seriesRadialMin + rd * 4); | |
284 | m_series6->append(seriesAngularMin + ad * 6, seriesRadialMin + rd * 8); |
|
284 | m_series6->append(seriesAngularMin + ad * 6, seriesRadialMin + rd * 8); | |
285 | m_series6->append(seriesAngularMin + ad * 5, seriesRadialMin + rd * 12); |
|
285 | m_series6->append(seriesAngularMin + ad * 5, seriesRadialMin + rd * 12); | |
286 | m_series6->append(seriesAngularMin + ad * 4, seriesRadialMin + rd * 9); |
|
286 | m_series6->append(seriesAngularMin + ad * 4, seriesRadialMin + rd * 9); | |
287 | m_series6->append(seriesAngularMin + ad * 3, seriesRadialMin + rd * 8); |
|
287 | m_series6->append(seriesAngularMin + ad * 3, seriesRadialMin + rd * 8); | |
288 | m_series6->append(seriesAngularMin + ad * 2, seriesRadialMin + rd * 7); |
|
288 | m_series6->append(seriesAngularMin + ad * 2, seriesRadialMin + rd * 7); | |
289 | m_series6->append(seriesAngularMin + ad, seriesRadialMin + rd * 4); |
|
289 | m_series6->append(seriesAngularMin + ad, seriesRadialMin + rd * 4); | |
290 | m_series6->append(seriesAngularMin, seriesRadialMin + rd * 10); |
|
290 | m_series6->append(seriesAngularMin, seriesRadialMin + rd * 10); | |
291 |
|
291 | |||
292 | m_series6->setPointsVisible(true); |
|
292 | m_series6->setPointsVisible(true); | |
293 | QPen series6Pen = QPen(Qt::red, 10); |
|
293 | QPen series6Pen = QPen(Qt::red, 10); | |
294 | //series6Pen.setStyle(Qt::DashDotDotLine); |
|
294 | //series6Pen.setStyle(Qt::DashDotDotLine); | |
295 | m_series6->setPen(series6Pen); |
|
295 | m_series6->setPen(series6Pen); | |
296 |
|
296 | |||
297 | // m_series7 shows points at category intersections |
|
297 | // m_series7 shows points at category intersections | |
298 | m_series7 = new QScatterSeries(); |
|
298 | m_series7 = new QScatterSeries(); | |
299 | m_series7->setName("Category check"); |
|
299 | m_series7->setName("Category check"); | |
300 | m_series7->setMarkerSize(7); |
|
300 | m_series7->setMarkerSize(7); | |
301 | m_series7->setBrush(QColor(Qt::red)); |
|
301 | m_series7->setBrush(QColor(Qt::red)); | |
302 | m_series7->setMarkerShape(QScatterSeries::MarkerShapeRectangle); |
|
302 | m_series7->setMarkerShape(QScatterSeries::MarkerShapeRectangle); | |
303 | *m_series7 << QPointF(1000, 1000) |
|
303 | *m_series7 << QPointF(1000, 1000) | |
304 | << QPointF(1000, 2000) |
|
304 | << QPointF(1000, 2000) | |
305 | << QPointF(1000, 4000) |
|
305 | << QPointF(1000, 4000) | |
306 | << QPointF(1000, 9000) |
|
306 | << QPointF(1000, 9000) | |
307 | << QPointF(1000, 14000) |
|
307 | << QPointF(1000, 14000) | |
308 | << QPointF(1000, 16500) |
|
308 | << QPointF(1000, 16500) | |
309 | << QPointF(1000, 19000) |
|
309 | << QPointF(1000, 19000) | |
310 |
|
310 | |||
311 | << QPointF(4000, 1000) |
|
311 | << QPointF(4000, 1000) | |
312 | << QPointF(4000, 2000) |
|
312 | << QPointF(4000, 2000) | |
313 | << QPointF(4000, 4000) |
|
313 | << QPointF(4000, 4000) | |
314 | << QPointF(4000, 9000) |
|
314 | << QPointF(4000, 9000) | |
315 | << QPointF(4000, 14000) |
|
315 | << QPointF(4000, 14000) | |
316 | << QPointF(4000, 16500) |
|
316 | << QPointF(4000, 16500) | |
317 | << QPointF(4000, 19000) |
|
317 | << QPointF(4000, 19000) | |
318 |
|
318 | |||
319 | << QPointF(7000, 1000) |
|
319 | << QPointF(7000, 1000) | |
320 | << QPointF(7000, 2000) |
|
320 | << QPointF(7000, 2000) | |
321 | << QPointF(7000, 4000) |
|
321 | << QPointF(7000, 4000) | |
322 | << QPointF(7000, 9000) |
|
322 | << QPointF(7000, 9000) | |
323 | << QPointF(7000, 14000) |
|
323 | << QPointF(7000, 14000) | |
324 | << QPointF(7000, 16500) |
|
324 | << QPointF(7000, 16500) | |
325 | << QPointF(7000, 19000) |
|
325 | << QPointF(7000, 19000) | |
326 |
|
326 | |||
327 | << QPointF(12000, 1000) |
|
327 | << QPointF(12000, 1000) | |
328 | << QPointF(12000, 2000) |
|
328 | << QPointF(12000, 2000) | |
329 | << QPointF(12000, 4000) |
|
329 | << QPointF(12000, 4000) | |
330 | << QPointF(12000, 9000) |
|
330 | << QPointF(12000, 9000) | |
331 | << QPointF(12000, 14000) |
|
331 | << QPointF(12000, 14000) | |
332 | << QPointF(12000, 16500) |
|
332 | << QPointF(12000, 16500) | |
333 | << QPointF(12000, 19000) |
|
333 | << QPointF(12000, 19000) | |
334 |
|
334 | |||
335 | << QPointF(17000, 1000) |
|
335 | << QPointF(17000, 1000) | |
336 | << QPointF(17000, 2000) |
|
336 | << QPointF(17000, 2000) | |
337 | << QPointF(17000, 4000) |
|
337 | << QPointF(17000, 4000) | |
338 | << QPointF(17000, 9000) |
|
338 | << QPointF(17000, 9000) | |
339 | << QPointF(17000, 14000) |
|
339 | << QPointF(17000, 14000) | |
340 | << QPointF(17000, 16500) |
|
340 | << QPointF(17000, 16500) | |
341 | << QPointF(17000, 19000) |
|
341 | << QPointF(17000, 19000) | |
342 |
|
342 | |||
343 | << QPointF(22000, 1000) |
|
343 | << QPointF(22000, 1000) | |
344 | << QPointF(22000, 2000) |
|
344 | << QPointF(22000, 2000) | |
345 | << QPointF(22000, 4000) |
|
345 | << QPointF(22000, 4000) | |
346 | << QPointF(22000, 9000) |
|
346 | << QPointF(22000, 9000) | |
347 | << QPointF(22000, 14000) |
|
347 | << QPointF(22000, 14000) | |
348 | << QPointF(22000, 16500) |
|
348 | << QPointF(22000, 16500) | |
349 | << QPointF(22000, 19000) |
|
349 | << QPointF(22000, 19000) | |
350 |
|
350 | |||
351 | << QPointF(28000, 1000) |
|
351 | << QPointF(28000, 1000) | |
352 | << QPointF(28000, 2000) |
|
352 | << QPointF(28000, 2000) | |
353 | << QPointF(28000, 4000) |
|
353 | << QPointF(28000, 4000) | |
354 | << QPointF(28000, 9000) |
|
354 | << QPointF(28000, 9000) | |
355 | << QPointF(28000, 14000) |
|
355 | << QPointF(28000, 14000) | |
356 | << QPointF(28000, 16500) |
|
356 | << QPointF(28000, 16500) | |
357 | << QPointF(28000, 19000); |
|
357 | << QPointF(28000, 19000); | |
358 |
|
358 | |||
359 | m_chart = new QPolarChart(); |
|
359 | m_chart = new QPolarChart(); | |
360 |
|
360 | |||
361 | m_chart->addSeries(m_series1); |
|
361 | m_chart->addSeries(m_series1); | |
362 | m_chart->addSeries(m_series2); |
|
362 | m_chart->addSeries(m_series2); | |
363 | m_chart->addSeries(m_series3); |
|
363 | m_chart->addSeries(m_series3); | |
364 | m_chart->addSeries(m_series4); |
|
364 | m_chart->addSeries(m_series4); | |
365 | m_chart->addSeries(m_series5); |
|
365 | m_chart->addSeries(m_series5); | |
366 | m_chart->addSeries(m_series6); |
|
366 | m_chart->addSeries(m_series6); | |
367 | m_chart->addSeries(m_series7); |
|
367 | m_chart->addSeries(m_series7); | |
368 |
|
368 | |||
369 | connect(m_series1, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); |
|
369 | connect(m_series1, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); | |
370 | connect(m_series2, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); |
|
370 | connect(m_series2, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); | |
371 | connect(m_series3, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); |
|
371 | connect(m_series3, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); | |
372 | connect(m_series4, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); |
|
372 | connect(m_series4, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); | |
373 | connect(m_series5, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); |
|
373 | connect(m_series5, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); | |
374 | connect(m_series6, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); |
|
374 | connect(m_series6, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); | |
375 | connect(m_series7, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); |
|
375 | connect(m_series7, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF))); | |
376 | connect(m_series1, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); |
|
376 | connect(m_series1, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); | |
377 | connect(m_series2, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); |
|
377 | connect(m_series2, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); | |
378 | connect(m_series3, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); |
|
378 | connect(m_series3, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); | |
379 | connect(m_series4, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); |
|
379 | connect(m_series4, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); | |
380 | connect(m_series5, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); |
|
380 | connect(m_series5, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); | |
381 | connect(m_series6, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); |
|
381 | connect(m_series6, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); | |
382 | connect(m_series7, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); |
|
382 | connect(m_series7, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool))); | |
383 |
|
383 | |||
384 | m_chart->setTitle("Use arrow keys to scroll and +/- to zoom"); |
|
384 | m_chart->setTitle("Use arrow keys to scroll and +/- to zoom"); | |
385 | m_chart->setAnimationOptions(m_animationOptions); |
|
385 | m_chart->setAnimationOptions(m_animationOptions); | |
386 | //m_chart->legend()->setVisible(false); |
|
386 | //m_chart->legend()->setVisible(false); | |
387 | m_chart->setAcceptHoverEvents(true); |
|
387 | m_chart->setAcceptHoverEvents(true); | |
388 | m_chart->setBackgroundBrush(*m_backgroundBrush); |
|
388 | m_chart->setBackgroundBrush(*m_backgroundBrush); | |
389 | m_chart->setBackgroundPen(*m_backgroundPen); |
|
389 | m_chart->setBackgroundPen(*m_backgroundPen); | |
390 | m_chart->setPlotAreaBackgroundBrush(*m_plotAreaBackgroundBrush); |
|
390 | m_chart->setPlotAreaBackgroundBrush(*m_plotAreaBackgroundBrush); | |
391 | m_chart->setPlotAreaBackgroundPen(*m_plotAreaBackgroundPen); |
|
391 | m_chart->setPlotAreaBackgroundPen(*m_plotAreaBackgroundPen); | |
392 | } |
|
392 | } | |
393 |
|
393 | |||
394 | void MainWindow::setAngularAxis(MainWindow::AxisMode mode) |
|
394 | void MainWindow::setAngularAxis(MainWindow::AxisMode mode) | |
395 | { |
|
395 | { | |
396 | if (m_angularAxis) { |
|
396 | if (m_angularAxis) { | |
397 | m_chart->removeAxis(m_angularAxis); |
|
397 | m_chart->removeAxis(m_angularAxis); | |
398 | delete m_angularAxis; |
|
398 | delete m_angularAxis; | |
399 | m_angularAxis = 0; |
|
399 | m_angularAxis = 0; | |
400 | } |
|
400 | } | |
401 |
|
401 | |||
402 | m_angularAxisMode = mode; |
|
402 | m_angularAxisMode = mode; | |
403 |
|
403 | |||
404 | switch (m_angularAxisMode) { |
|
404 | switch (m_angularAxisMode) { | |
405 | case AxisModeNone: |
|
405 | case AxisModeNone: | |
406 | return; |
|
406 | return; | |
407 | case AxisModeValue: |
|
407 | case AxisModeValue: | |
408 | m_angularAxis = new QValueAxis(); |
|
408 | m_angularAxis = new QValueAxis(); | |
409 | static_cast<QValueAxis *>(m_angularAxis)->setTickCount(m_angularTickCount); |
|
409 | static_cast<QValueAxis *>(m_angularAxis)->setTickCount(m_angularTickCount); | |
410 | static_cast<QValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat); |
|
410 | static_cast<QValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat); | |
411 | break; |
|
411 | break; | |
412 | case AxisModeLogValue: |
|
412 | case AxisModeLogValue: | |
413 | m_angularAxis = new QLogValueAxis(); |
|
413 | m_angularAxis = new QLogValueAxis(); | |
414 | static_cast<QLogValueAxis *>(m_angularAxis)->setBase(m_base); |
|
414 | static_cast<QLogValueAxis *>(m_angularAxis)->setBase(m_base); | |
415 | static_cast<QLogValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat); |
|
415 | static_cast<QLogValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat); | |
416 | break; |
|
416 | break; | |
417 | case AxisModeDateTime: |
|
417 | case AxisModeDateTime: | |
418 | m_angularAxis = new QDateTimeAxis(); |
|
418 | m_angularAxis = new QDateTimeAxis(); | |
419 | static_cast<QDateTimeAxis *>(m_angularAxis)->setTickCount(m_angularTickCount); |
|
419 | static_cast<QDateTimeAxis *>(m_angularAxis)->setTickCount(m_angularTickCount); | |
420 | static_cast<QDateTimeAxis *>(m_angularAxis)->setFormat(m_dateFormat); |
|
420 | static_cast<QDateTimeAxis *>(m_angularAxis)->setFormat(m_dateFormat); | |
421 | break; |
|
421 | break; | |
422 | case AxisModeCategory: |
|
422 | case AxisModeCategory: | |
423 | m_angularAxis = new QCategoryAxis(); |
|
423 | m_angularAxis = new QCategoryAxis(); | |
424 | applyCategories(); |
|
424 | applyCategories(); | |
425 | break; |
|
425 | break; | |
426 | default: |
|
426 | default: | |
427 | qWarning() << "Unsupported AxisMode"; |
|
427 | qWarning() << "Unsupported AxisMode"; | |
428 | break; |
|
428 | break; | |
429 | } |
|
429 | } | |
430 |
|
430 | |||
431 | m_angularAxis->setLabelsAngle(m_labelsAngle); |
|
431 | m_angularAxis->setLabelsAngle(m_labelsAngle); | |
432 | m_angularAxis->setLabelsFont(m_currentLabelFont); |
|
432 | m_angularAxis->setLabelsFont(m_currentLabelFont); | |
433 | m_angularAxis->setLabelsBrush(*m_labelBrush); |
|
433 | m_angularAxis->setLabelsBrush(*m_labelBrush); | |
434 | m_angularAxis->setLabelsPen(*m_labelPen); |
|
434 | m_angularAxis->setLabelsPen(*m_labelPen); | |
435 | m_angularAxis->setLabelsVisible(m_labelsVisible); |
|
435 | m_angularAxis->setLabelsVisible(m_labelsVisible); | |
436 | m_angularAxis->setShadesBrush(*m_angularShadesBrush); |
|
436 | m_angularAxis->setShadesBrush(*m_angularShadesBrush); | |
437 | m_angularAxis->setShadesPen(*m_angularShadesPen); |
|
437 | m_angularAxis->setShadesPen(*m_angularShadesPen); | |
438 | m_angularAxis->setShadesVisible(m_angularShadesVisible); |
|
438 | m_angularAxis->setShadesVisible(m_angularShadesVisible); | |
439 | m_angularAxis->setTitleFont(m_currentTitleFont); |
|
439 | m_angularAxis->setTitleFont(m_currentTitleFont); | |
440 | m_angularAxis->setTitleBrush(*m_titleBrush); |
|
440 | m_angularAxis->setTitleBrush(*m_titleBrush); | |
441 | m_angularAxis->setTitlePen(*m_titlePen); |
|
441 | m_angularAxis->setTitlePen(*m_titlePen); | |
442 | m_angularAxis->setTitleVisible(m_titleVisible); |
|
442 | m_angularAxis->setTitleVisible(m_titleVisible); | |
443 | m_angularAxis->setTitleText(m_angularTitle); |
|
443 | m_angularAxis->setTitleText(m_angularTitle); | |
444 | m_angularAxis->setGridLinePen(*m_gridPen); |
|
444 | m_angularAxis->setGridLinePen(*m_gridPen); | |
445 | m_angularAxis->setGridLineVisible(m_gridVisible); |
|
445 | m_angularAxis->setGridLineVisible(m_gridVisible); | |
446 | m_angularAxis->setLinePen(*m_arrowPen); |
|
446 | m_angularAxis->setLinePen(*m_arrowPen); | |
447 | m_angularAxis->setLineVisible(m_arrowVisible); |
|
447 | m_angularAxis->setLineVisible(m_arrowVisible); | |
448 |
|
448 | |||
449 | m_chart->addAxis(m_angularAxis, QPolarChart::PolarOrientationAngular); |
|
449 | m_chart->addAxis(m_angularAxis, QPolarChart::PolarOrientationAngular); | |
450 |
|
450 | |||
451 | m_series1->attachAxis(m_angularAxis); |
|
451 | m_series1->attachAxis(m_angularAxis); | |
452 | m_series2->attachAxis(m_angularAxis); |
|
452 | m_series2->attachAxis(m_angularAxis); | |
453 | m_series3->attachAxis(m_angularAxis); |
|
453 | m_series3->attachAxis(m_angularAxis); | |
454 | m_series4->attachAxis(m_angularAxis); |
|
454 | m_series4->attachAxis(m_angularAxis); | |
455 | m_series5->attachAxis(m_angularAxis); |
|
455 | m_series5->attachAxis(m_angularAxis); | |
456 | m_series6->attachAxis(m_angularAxis); |
|
456 | m_series6->attachAxis(m_angularAxis); | |
457 | m_series7->attachAxis(m_angularAxis); |
|
457 | m_series7->attachAxis(m_angularAxis); | |
458 |
|
458 | |||
459 | applyRanges(); |
|
459 | applyRanges(); | |
460 |
|
460 | |||
461 | //connect(m_angularAxis, SIGNAL(rangeChanged(qreal, qreal)), this, SLOT(angularRangeChanged(qreal, qreal))); |
|
461 | //connect(m_angularAxis, SIGNAL(rangeChanged(qreal, qreal)), this, SLOT(angularRangeChanged(qreal, qreal))); | |
462 | } |
|
462 | } | |
463 |
|
463 | |||
464 | void MainWindow::setRadialAxis(MainWindow::AxisMode mode) |
|
464 | void MainWindow::setRadialAxis(MainWindow::AxisMode mode) | |
465 | { |
|
465 | { | |
466 | if (m_radialAxis) { |
|
466 | if (m_radialAxis) { | |
467 | m_chart->removeAxis(m_radialAxis); |
|
467 | m_chart->removeAxis(m_radialAxis); | |
468 | delete m_radialAxis; |
|
468 | delete m_radialAxis; | |
469 | m_radialAxis = 0; |
|
469 | m_radialAxis = 0; | |
470 | } |
|
470 | } | |
471 |
|
471 | |||
472 | m_radialAxisMode = mode; |
|
472 | m_radialAxisMode = mode; | |
473 |
|
473 | |||
474 | switch (m_radialAxisMode) { |
|
474 | switch (m_radialAxisMode) { | |
475 | case AxisModeNone: |
|
475 | case AxisModeNone: | |
476 | return; |
|
476 | return; | |
477 | case AxisModeValue: |
|
477 | case AxisModeValue: | |
478 | m_radialAxis = new QValueAxis(); |
|
478 | m_radialAxis = new QValueAxis(); | |
479 | static_cast<QValueAxis *>(m_radialAxis)->setTickCount(m_radialTickCount); |
|
479 | static_cast<QValueAxis *>(m_radialAxis)->setTickCount(m_radialTickCount); | |
480 | static_cast<QValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat); |
|
480 | static_cast<QValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat); | |
481 | break; |
|
481 | break; | |
482 | case AxisModeLogValue: |
|
482 | case AxisModeLogValue: | |
483 | m_radialAxis = new QLogValueAxis(); |
|
483 | m_radialAxis = new QLogValueAxis(); | |
484 | static_cast<QLogValueAxis *>(m_radialAxis)->setBase(m_base); |
|
484 | static_cast<QLogValueAxis *>(m_radialAxis)->setBase(m_base); | |
485 | static_cast<QLogValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat); |
|
485 | static_cast<QLogValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat); | |
486 | break; |
|
486 | break; | |
487 | case AxisModeDateTime: |
|
487 | case AxisModeDateTime: | |
488 | m_radialAxis = new QDateTimeAxis(); |
|
488 | m_radialAxis = new QDateTimeAxis(); | |
489 | static_cast<QDateTimeAxis *>(m_radialAxis)->setTickCount(m_radialTickCount); |
|
489 | static_cast<QDateTimeAxis *>(m_radialAxis)->setTickCount(m_radialTickCount); | |
490 | static_cast<QDateTimeAxis *>(m_radialAxis)->setFormat(m_dateFormat); |
|
490 | static_cast<QDateTimeAxis *>(m_radialAxis)->setFormat(m_dateFormat); | |
491 | break; |
|
491 | break; | |
492 | case AxisModeCategory: |
|
492 | case AxisModeCategory: | |
493 | m_radialAxis = new QCategoryAxis(); |
|
493 | m_radialAxis = new QCategoryAxis(); | |
494 | applyCategories(); |
|
494 | applyCategories(); | |
495 | break; |
|
495 | break; | |
496 | default: |
|
496 | default: | |
497 | qWarning() << "Unsupported AxisMode"; |
|
497 | qWarning() << "Unsupported AxisMode"; | |
498 | break; |
|
498 | break; | |
499 | } |
|
499 | } | |
500 |
|
500 | |||
501 | m_radialAxis->setLabelsAngle(m_labelsAngle); |
|
501 | m_radialAxis->setLabelsAngle(m_labelsAngle); | |
502 | m_radialAxis->setLabelsFont(m_currentLabelFont); |
|
502 | m_radialAxis->setLabelsFont(m_currentLabelFont); | |
503 | m_radialAxis->setLabelsBrush(*m_labelBrush); |
|
503 | m_radialAxis->setLabelsBrush(*m_labelBrush); | |
504 | m_radialAxis->setLabelsPen(*m_labelPen); |
|
504 | m_radialAxis->setLabelsPen(*m_labelPen); | |
505 | m_radialAxis->setLabelsVisible(m_labelsVisible); |
|
505 | m_radialAxis->setLabelsVisible(m_labelsVisible); | |
506 | m_radialAxis->setShadesBrush(*m_radialShadesBrush); |
|
506 | m_radialAxis->setShadesBrush(*m_radialShadesBrush); | |
507 | m_radialAxis->setShadesPen(*m_radialShadesPen); |
|
507 | m_radialAxis->setShadesPen(*m_radialShadesPen); | |
508 | m_radialAxis->setShadesVisible(m_radialShadesVisible); |
|
508 | m_radialAxis->setShadesVisible(m_radialShadesVisible); | |
509 | m_radialAxis->setTitleFont(m_currentTitleFont); |
|
509 | m_radialAxis->setTitleFont(m_currentTitleFont); | |
510 | m_radialAxis->setTitleBrush(*m_titleBrush); |
|
510 | m_radialAxis->setTitleBrush(*m_titleBrush); | |
511 | m_radialAxis->setTitlePen(*m_titlePen); |
|
511 | m_radialAxis->setTitlePen(*m_titlePen); | |
512 | m_radialAxis->setTitleVisible(m_titleVisible); |
|
512 | m_radialAxis->setTitleVisible(m_titleVisible); | |
513 | m_radialAxis->setTitleText(m_radialTitle); |
|
513 | m_radialAxis->setTitleText(m_radialTitle); | |
514 | m_radialAxis->setGridLinePen(*m_gridPen); |
|
514 | m_radialAxis->setGridLinePen(*m_gridPen); | |
515 | m_radialAxis->setGridLineVisible(m_gridVisible); |
|
515 | m_radialAxis->setGridLineVisible(m_gridVisible); | |
516 | m_radialAxis->setLinePen(*m_arrowPen); |
|
516 | m_radialAxis->setLinePen(*m_arrowPen); | |
517 | m_radialAxis->setLineVisible(m_arrowVisible); |
|
517 | m_radialAxis->setLineVisible(m_arrowVisible); | |
518 |
|
518 | |||
519 | m_chart->addAxis(m_radialAxis, QPolarChart::PolarOrientationRadial); |
|
519 | m_chart->addAxis(m_radialAxis, QPolarChart::PolarOrientationRadial); | |
520 |
|
520 | |||
521 | m_series1->attachAxis(m_radialAxis); |
|
521 | m_series1->attachAxis(m_radialAxis); | |
522 | m_series2->attachAxis(m_radialAxis); |
|
522 | m_series2->attachAxis(m_radialAxis); | |
523 | m_series3->attachAxis(m_radialAxis); |
|
523 | m_series3->attachAxis(m_radialAxis); | |
524 | m_series4->attachAxis(m_radialAxis); |
|
524 | m_series4->attachAxis(m_radialAxis); | |
525 | m_series5->attachAxis(m_radialAxis); |
|
525 | m_series5->attachAxis(m_radialAxis); | |
526 | m_series6->attachAxis(m_radialAxis); |
|
526 | m_series6->attachAxis(m_radialAxis); | |
527 | m_series7->attachAxis(m_radialAxis); |
|
527 | m_series7->attachAxis(m_radialAxis); | |
528 |
|
528 | |||
529 | applyRanges(); |
|
529 | applyRanges(); | |
530 |
|
530 | |||
531 | series1CheckBoxChecked(); |
|
531 | series1CheckBoxChecked(); | |
532 | series2CheckBoxChecked(); |
|
532 | series2CheckBoxChecked(); | |
533 | series3CheckBoxChecked(); |
|
533 | series3CheckBoxChecked(); | |
534 | series4CheckBoxChecked(); |
|
534 | series4CheckBoxChecked(); | |
535 | series5CheckBoxChecked(); |
|
535 | series5CheckBoxChecked(); | |
536 | series6CheckBoxChecked(); |
|
536 | series6CheckBoxChecked(); | |
537 | series7CheckBoxChecked(); |
|
537 | series7CheckBoxChecked(); | |
538 |
|
538 | |||
539 | //connect(m_radialAxis, SIGNAL(rangeChanged(qreal, qreal)), this, SLOT(radialRangeChanged(qreal, qreal))); |
|
539 | //connect(m_radialAxis, SIGNAL(rangeChanged(qreal, qreal)), this, SLOT(radialRangeChanged(qreal, qreal))); | |
540 | } |
|
540 | } | |
541 |
|
541 | |||
542 | void MainWindow::applyRanges() |
|
542 | void MainWindow::applyRanges() | |
543 | { |
|
543 | { | |
544 | if (ui->niceNumbersCheckBox->isChecked()) { |
|
544 | if (ui->niceNumbersCheckBox->isChecked()) { | |
545 | if (m_angularAxisMode == AxisModeValue) { |
|
545 | if (m_angularAxisMode == AxisModeValue) { | |
546 | static_cast<QValueAxis *>(m_angularAxis)->applyNiceNumbers(); |
|
546 | static_cast<QValueAxis *>(m_angularAxis)->applyNiceNumbers(); | |
547 | m_angularMin = static_cast<QValueAxis *>(m_angularAxis)->min(); |
|
547 | m_angularMin = static_cast<QValueAxis *>(m_angularAxis)->min(); | |
548 | m_angularMax = static_cast<QValueAxis *>(m_angularAxis)->max(); |
|
548 | m_angularMax = static_cast<QValueAxis *>(m_angularAxis)->max(); | |
549 | m_angularTickCount = static_cast<QValueAxis *>(m_angularAxis)->tickCount(); |
|
549 | m_angularTickCount = static_cast<QValueAxis *>(m_angularAxis)->tickCount(); | |
550 | } |
|
550 | } | |
551 | if (m_radialAxisMode == AxisModeValue) { |
|
551 | if (m_radialAxisMode == AxisModeValue) { | |
552 | static_cast<QValueAxis *>(m_radialAxis)->applyNiceNumbers(); |
|
552 | static_cast<QValueAxis *>(m_radialAxis)->applyNiceNumbers(); | |
553 | m_radialMin = static_cast<QValueAxis *>(m_radialAxis)->min(); |
|
553 | m_radialMin = static_cast<QValueAxis *>(m_radialAxis)->min(); | |
554 | m_radialMax = static_cast<QValueAxis *>(m_radialAxis)->max(); |
|
554 | m_radialMax = static_cast<QValueAxis *>(m_radialAxis)->max(); | |
555 | m_radialTickCount = static_cast<QValueAxis *>(m_radialAxis)->tickCount(); |
|
555 | m_radialTickCount = static_cast<QValueAxis *>(m_radialAxis)->tickCount(); | |
556 | } |
|
556 | } | |
557 | } |
|
557 | } | |
558 |
|
558 | |||
559 | if (m_angularAxis) |
|
559 | if (m_angularAxis) | |
560 | m_angularAxis->setRange(m_angularMin, m_angularMax); |
|
560 | m_angularAxis->setRange(m_angularMin, m_angularMax); | |
561 | if (m_radialAxis) |
|
561 | if (m_radialAxis) | |
562 | m_radialAxis->setRange(m_radialMin, m_radialMax); |
|
562 | m_radialAxis->setRange(m_radialMin, m_radialMax); | |
563 | } |
|
563 | } | |
564 |
|
564 | |||
565 | void MainWindow::angularTicksChanged(int value) |
|
565 | void MainWindow::angularTicksChanged(int value) | |
566 | { |
|
566 | { | |
567 | m_angularTickCount = value; |
|
567 | m_angularTickCount = value; | |
568 | if (m_angularAxisMode == AxisModeValue) |
|
568 | if (m_angularAxisMode == AxisModeValue) | |
569 | static_cast<QValueAxis *>(m_angularAxis)->setTickCount(m_angularTickCount); |
|
569 | static_cast<QValueAxis *>(m_angularAxis)->setTickCount(m_angularTickCount); | |
570 | else if (m_angularAxisMode == AxisModeDateTime) |
|
570 | else if (m_angularAxisMode == AxisModeDateTime) | |
571 | static_cast<QDateTimeAxis *>(m_angularAxis)->setTickCount(m_angularTickCount); |
|
571 | static_cast<QDateTimeAxis *>(m_angularAxis)->setTickCount(m_angularTickCount); | |
572 | } |
|
572 | } | |
573 |
|
573 | |||
574 | void MainWindow::radialTicksChanged(int value) |
|
574 | void MainWindow::radialTicksChanged(int value) | |
575 | { |
|
575 | { | |
576 | m_radialTickCount = value; |
|
576 | m_radialTickCount = value; | |
577 | if (m_radialAxisMode == AxisModeValue) |
|
577 | if (m_radialAxisMode == AxisModeValue) | |
578 | static_cast<QValueAxis *>(m_radialAxis)->setTickCount(m_radialTickCount); |
|
578 | static_cast<QValueAxis *>(m_radialAxis)->setTickCount(m_radialTickCount); | |
579 | else if (m_radialAxisMode == AxisModeDateTime) |
|
579 | else if (m_radialAxisMode == AxisModeDateTime) | |
580 | static_cast<QDateTimeAxis *>(m_radialAxis)->setTickCount(m_radialTickCount); |
|
580 | static_cast<QDateTimeAxis *>(m_radialAxis)->setTickCount(m_radialTickCount); | |
581 | } |
|
581 | } | |
582 |
|
582 | |||
583 | void MainWindow::anglesChanged(int value) |
|
583 | void MainWindow::anglesChanged(int value) | |
584 | { |
|
584 | { | |
585 | m_labelsAngle = value; |
|
585 | m_labelsAngle = value; | |
586 | m_radialAxis->setLabelsAngle(m_labelsAngle); |
|
586 | m_radialAxis->setLabelsAngle(m_labelsAngle); | |
587 | m_angularAxis->setLabelsAngle(m_labelsAngle); |
|
587 | m_angularAxis->setLabelsAngle(m_labelsAngle); | |
588 | } |
|
588 | } | |
589 |
|
589 | |||
590 | void MainWindow::angularMinChanged(double value) |
|
590 | void MainWindow::angularMinChanged(double value) | |
591 | { |
|
591 | { | |
592 | m_angularMin = value; |
|
592 | m_angularMin = value; | |
593 | if (m_angularAxisMode != AxisModeDateTime) { |
|
593 | if (m_angularAxisMode != AxisModeDateTime) { | |
594 | m_angularAxis->setMin(m_angularMin); |
|
594 | m_angularAxis->setMin(m_angularMin); | |
595 | } else { |
|
595 | } else { | |
596 | QDateTime dateTime; |
|
596 | QDateTime dateTime; | |
597 | dateTime.setMSecsSinceEpoch(qint64(m_angularMin)); |
|
597 | dateTime.setMSecsSinceEpoch(qint64(m_angularMin)); | |
598 | m_angularAxis->setMin(dateTime); |
|
598 | m_angularAxis->setMin(dateTime); | |
599 | } |
|
599 | } | |
600 | } |
|
600 | } | |
601 |
|
601 | |||
602 | void MainWindow::angularMaxChanged(double value) |
|
602 | void MainWindow::angularMaxChanged(double value) | |
603 | { |
|
603 | { | |
604 | m_angularMax = value; |
|
604 | m_angularMax = value; | |
605 | if (m_angularAxisMode != AxisModeDateTime) { |
|
605 | if (m_angularAxisMode != AxisModeDateTime) { | |
606 | m_angularAxis->setMax(m_angularMax); |
|
606 | m_angularAxis->setMax(m_angularMax); | |
607 | } else { |
|
607 | } else { | |
608 | QDateTime dateTime; |
|
608 | QDateTime dateTime; | |
609 | dateTime.setMSecsSinceEpoch(qint64(m_angularMax)); |
|
609 | dateTime.setMSecsSinceEpoch(qint64(m_angularMax)); | |
610 | m_angularAxis->setMax(dateTime); |
|
610 | m_angularAxis->setMax(dateTime); | |
611 | } |
|
611 | } | |
612 | } |
|
612 | } | |
613 |
|
613 | |||
614 | void MainWindow::radialMinChanged(double value) |
|
614 | void MainWindow::radialMinChanged(double value) | |
615 | { |
|
615 | { | |
616 | m_radialMin = value; |
|
616 | m_radialMin = value; | |
617 | if (m_radialAxisMode != AxisModeDateTime) { |
|
617 | if (m_radialAxisMode != AxisModeDateTime) { | |
618 | m_radialAxis->setMin(m_radialMin); |
|
618 | m_radialAxis->setMin(m_radialMin); | |
619 | } else { |
|
619 | } else { | |
620 | QDateTime dateTime; |
|
620 | QDateTime dateTime; | |
621 | dateTime.setMSecsSinceEpoch(qint64(m_radialMin)); |
|
621 | dateTime.setMSecsSinceEpoch(qint64(m_radialMin)); | |
622 | m_radialAxis->setMin(dateTime); |
|
622 | m_radialAxis->setMin(dateTime); | |
623 | } |
|
623 | } | |
624 | } |
|
624 | } | |
625 |
|
625 | |||
626 | void MainWindow::radialMaxChanged(double value) |
|
626 | void MainWindow::radialMaxChanged(double value) | |
627 | { |
|
627 | { | |
628 | m_radialMax = value; |
|
628 | m_radialMax = value; | |
629 | if (m_radialAxisMode != AxisModeDateTime) { |
|
629 | if (m_radialAxisMode != AxisModeDateTime) { | |
630 | m_radialAxis->setMax(m_radialMax); |
|
630 | m_radialAxis->setMax(m_radialMax); | |
631 | } else { |
|
631 | } else { | |
632 | QDateTime dateTime; |
|
632 | QDateTime dateTime; | |
633 | dateTime.setMSecsSinceEpoch(qint64(m_radialMax)); |
|
633 | dateTime.setMSecsSinceEpoch(qint64(m_radialMax)); | |
634 | m_radialAxis->setMax(dateTime); |
|
634 | m_radialAxis->setMax(dateTime); | |
635 | } |
|
635 | } | |
636 | } |
|
636 | } | |
637 |
|
637 | |||
638 | void MainWindow::angularShadesIndexChanged(int index) |
|
638 | void MainWindow::angularShadesIndexChanged(int index) | |
639 | { |
|
639 | { | |
640 | delete m_angularShadesBrush; |
|
640 | delete m_angularShadesBrush; | |
641 | delete m_angularShadesPen; |
|
641 | delete m_angularShadesPen; | |
642 |
|
642 | |||
643 | switch (index) { |
|
643 | switch (index) { | |
644 | case 0: |
|
644 | case 0: | |
645 | m_angularShadesBrush = new QBrush(Qt::NoBrush); |
|
645 | m_angularShadesBrush = new QBrush(Qt::NoBrush); | |
646 | m_angularShadesPen = new QPen(Qt::NoPen); |
|
646 | m_angularShadesPen = new QPen(Qt::NoPen); | |
647 | m_angularShadesVisible = false; |
|
647 | m_angularShadesVisible = false; | |
648 | break; |
|
648 | break; | |
649 | case 1: |
|
649 | case 1: | |
650 | m_angularShadesBrush = new QBrush(Qt::lightGray); |
|
650 | m_angularShadesBrush = new QBrush(Qt::lightGray); | |
651 | m_angularShadesPen = new QPen(Qt::NoPen); |
|
651 | m_angularShadesPen = new QPen(Qt::NoPen); | |
652 | m_angularShadesVisible = true; |
|
652 | m_angularShadesVisible = true; | |
653 | break; |
|
653 | break; | |
654 | case 2: |
|
654 | case 2: | |
655 | m_angularShadesBrush = new QBrush(Qt::yellow); |
|
655 | m_angularShadesBrush = new QBrush(Qt::yellow); | |
656 | m_angularShadesPen = new QPen(Qt::DotLine); |
|
656 | m_angularShadesPen = new QPen(Qt::DotLine); | |
657 | m_angularShadesPen->setWidth(2); |
|
657 | m_angularShadesPen->setWidth(2); | |
658 | m_angularShadesVisible = true; |
|
658 | m_angularShadesVisible = true; | |
659 | break; |
|
659 | break; | |
660 | default: |
|
660 | default: | |
661 | break; |
|
661 | break; | |
662 | } |
|
662 | } | |
663 |
|
663 | |||
664 | m_angularAxis->setShadesBrush(*m_angularShadesBrush); |
|
664 | m_angularAxis->setShadesBrush(*m_angularShadesBrush); | |
665 | m_angularAxis->setShadesPen(*m_angularShadesPen); |
|
665 | m_angularAxis->setShadesPen(*m_angularShadesPen); | |
666 | m_angularAxis->setShadesVisible(m_angularShadesVisible); |
|
666 | m_angularAxis->setShadesVisible(m_angularShadesVisible); | |
667 | } |
|
667 | } | |
668 |
|
668 | |||
669 | void MainWindow::radialShadesIndexChanged(int index) |
|
669 | void MainWindow::radialShadesIndexChanged(int index) | |
670 | { |
|
670 | { | |
671 | delete m_radialShadesBrush; |
|
671 | delete m_radialShadesBrush; | |
672 | delete m_radialShadesPen; |
|
672 | delete m_radialShadesPen; | |
673 |
|
673 | |||
674 | switch (index) { |
|
674 | switch (index) { | |
675 | case 0: |
|
675 | case 0: | |
676 | m_radialShadesBrush = new QBrush(Qt::NoBrush); |
|
676 | m_radialShadesBrush = new QBrush(Qt::NoBrush); | |
677 | m_radialShadesPen = new QPen(Qt::NoPen); |
|
677 | m_radialShadesPen = new QPen(Qt::NoPen); | |
678 | m_radialShadesVisible = false; |
|
678 | m_radialShadesVisible = false; | |
679 | break; |
|
679 | break; | |
680 | case 1: |
|
680 | case 1: | |
681 | m_radialShadesBrush = new QBrush(Qt::green); |
|
681 | m_radialShadesBrush = new QBrush(Qt::green); | |
682 | m_radialShadesPen = new QPen(Qt::NoPen); |
|
682 | m_radialShadesPen = new QPen(Qt::NoPen); | |
683 | m_radialShadesVisible = true; |
|
683 | m_radialShadesVisible = true; | |
684 | break; |
|
684 | break; | |
685 | case 2: |
|
685 | case 2: | |
686 | m_radialShadesBrush = new QBrush(Qt::blue); |
|
686 | m_radialShadesBrush = new QBrush(Qt::blue); | |
687 | m_radialShadesPen = new QPen(Qt::DotLine); |
|
687 | m_radialShadesPen = new QPen(Qt::DotLine); | |
688 | m_radialShadesPen->setWidth(2); |
|
688 | m_radialShadesPen->setWidth(2); | |
689 | m_radialShadesVisible = true; |
|
689 | m_radialShadesVisible = true; | |
690 | break; |
|
690 | break; | |
691 | default: |
|
691 | default: | |
692 | break; |
|
692 | break; | |
693 | } |
|
693 | } | |
694 |
|
694 | |||
695 | m_radialAxis->setShadesBrush(*m_radialShadesBrush); |
|
695 | m_radialAxis->setShadesBrush(*m_radialShadesBrush); | |
696 | m_radialAxis->setShadesPen(*m_radialShadesPen); |
|
696 | m_radialAxis->setShadesPen(*m_radialShadesPen); | |
697 | m_radialAxis->setShadesVisible(m_radialShadesVisible); |
|
697 | m_radialAxis->setShadesVisible(m_radialShadesVisible); | |
698 | } |
|
698 | } | |
699 |
|
699 | |||
700 | void MainWindow::labelFormatEdited(const QString &text) |
|
700 | void MainWindow::labelFormatEdited(const QString &text) | |
701 | { |
|
701 | { | |
702 | m_labelFormat = text; |
|
702 | m_labelFormat = text; | |
703 | if (m_angularAxisMode == AxisModeValue) |
|
703 | if (m_angularAxisMode == AxisModeValue) | |
704 | static_cast<QValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat); |
|
704 | static_cast<QValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat); | |
705 | else if (m_angularAxisMode == AxisModeLogValue) |
|
705 | else if (m_angularAxisMode == AxisModeLogValue) | |
706 | static_cast<QLogValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat); |
|
706 | static_cast<QLogValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat); | |
707 |
|
707 | |||
708 | if (m_radialAxisMode == AxisModeValue) |
|
708 | if (m_radialAxisMode == AxisModeValue) | |
709 | static_cast<QValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat); |
|
709 | static_cast<QValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat); | |
710 | else if (m_radialAxisMode == AxisModeLogValue) |
|
710 | else if (m_radialAxisMode == AxisModeLogValue) | |
711 | static_cast<QLogValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat); |
|
711 | static_cast<QLogValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat); | |
712 | } |
|
712 | } | |
713 |
|
713 | |||
714 | void MainWindow::labelFontChanged(const QFont &font) |
|
714 | void MainWindow::labelFontChanged(const QFont &font) | |
715 | { |
|
715 | { | |
716 | m_currentLabelFont = font; |
|
716 | m_currentLabelFont = font; | |
717 | m_currentLabelFont.setPixelSize(ui->labelFontSizeSpin->value()); |
|
717 | m_currentLabelFont.setPixelSize(ui->labelFontSizeSpin->value()); | |
718 | m_angularAxis->setLabelsFont(m_currentLabelFont); |
|
718 | m_angularAxis->setLabelsFont(m_currentLabelFont); | |
719 | m_radialAxis->setLabelsFont(m_currentLabelFont); |
|
719 | m_radialAxis->setLabelsFont(m_currentLabelFont); | |
720 | } |
|
720 | } | |
721 |
|
721 | |||
722 | void MainWindow::labelFontSizeChanged(int value) |
|
722 | void MainWindow::labelFontSizeChanged(int value) | |
723 | { |
|
723 | { | |
724 | m_currentLabelFont = ui->labelFontComboBox->currentFont(); |
|
724 | m_currentLabelFont = ui->labelFontComboBox->currentFont(); | |
725 | m_currentLabelFont.setPixelSize(value); |
|
725 | m_currentLabelFont.setPixelSize(value); | |
726 | m_angularAxis->setLabelsFont(m_currentLabelFont); |
|
726 | m_angularAxis->setLabelsFont(m_currentLabelFont); | |
727 | m_radialAxis->setLabelsFont(m_currentLabelFont); |
|
727 | m_radialAxis->setLabelsFont(m_currentLabelFont); | |
728 | } |
|
728 | } | |
729 |
|
729 | |||
730 | void MainWindow::animationIndexChanged(int index) |
|
730 | void MainWindow::animationIndexChanged(int index) | |
731 | { |
|
731 | { | |
732 | switch (index) { |
|
732 | switch (index) { | |
733 | case 0: |
|
733 | case 0: | |
734 | m_animationOptions = QChart::NoAnimation; |
|
734 | m_animationOptions = QChart::NoAnimation; | |
735 | break; |
|
735 | break; | |
736 | case 1: |
|
736 | case 1: | |
737 | m_animationOptions = QChart::SeriesAnimations; |
|
737 | m_animationOptions = QChart::SeriesAnimations; | |
738 | break; |
|
738 | break; | |
739 | case 2: |
|
739 | case 2: | |
740 | m_animationOptions = QChart::GridAxisAnimations; |
|
740 | m_animationOptions = QChart::GridAxisAnimations; | |
741 | break; |
|
741 | break; | |
742 | case 3: |
|
742 | case 3: | |
743 | m_animationOptions = QChart::AllAnimations; |
|
743 | m_animationOptions = QChart::AllAnimations; | |
744 | break; |
|
744 | break; | |
745 | default: |
|
745 | default: | |
746 | break; |
|
746 | break; | |
747 | } |
|
747 | } | |
748 |
|
748 | |||
749 | m_chart->setAnimationOptions(m_animationOptions); |
|
749 | m_chart->setAnimationOptions(m_animationOptions); | |
750 | } |
|
750 | } | |
751 |
|
751 | |||
752 | void MainWindow::labelsIndexChanged(int index) |
|
752 | void MainWindow::labelsIndexChanged(int index) | |
753 | { |
|
753 | { | |
754 | delete m_labelBrush; |
|
754 | delete m_labelBrush; | |
755 | delete m_labelPen; |
|
755 | delete m_labelPen; | |
756 |
|
756 | |||
757 | switch (index) { |
|
757 | switch (index) { | |
758 | case 0: |
|
758 | case 0: | |
759 | m_labelBrush = new QBrush(Qt::NoBrush); |
|
759 | m_labelBrush = new QBrush(Qt::NoBrush); | |
760 | m_labelPen = new QPen(Qt::NoPen); |
|
760 | m_labelPen = new QPen(Qt::NoPen); | |
761 | m_labelsVisible = false; |
|
761 | m_labelsVisible = false; | |
762 | break; |
|
762 | break; | |
763 | case 1: |
|
763 | case 1: | |
764 | m_labelBrush = new QBrush(Qt::black); |
|
764 | m_labelBrush = new QBrush(Qt::black); | |
765 | m_labelPen = new QPen(Qt::NoPen); |
|
765 | m_labelPen = new QPen(Qt::NoPen); | |
766 | m_labelsVisible = true; |
|
766 | m_labelsVisible = true; | |
767 | break; |
|
767 | break; | |
768 | case 2: |
|
768 | case 2: | |
769 | m_labelBrush = new QBrush(Qt::white); |
|
769 | m_labelBrush = new QBrush(Qt::white); | |
770 | m_labelPen = new QPen(Qt::blue); |
|
770 | m_labelPen = new QPen(Qt::blue); | |
771 | m_labelsVisible = true; |
|
771 | m_labelsVisible = true; | |
772 | break; |
|
772 | break; | |
773 | default: |
|
773 | default: | |
774 | break; |
|
774 | break; | |
775 | } |
|
775 | } | |
776 |
|
776 | |||
777 | m_radialAxis->setLabelsBrush(*m_labelBrush); |
|
777 | m_radialAxis->setLabelsBrush(*m_labelBrush); | |
778 | m_radialAxis->setLabelsPen(*m_labelPen); |
|
778 | m_radialAxis->setLabelsPen(*m_labelPen); | |
779 | m_radialAxis->setLabelsVisible(m_labelsVisible); |
|
779 | m_radialAxis->setLabelsVisible(m_labelsVisible); | |
780 | m_angularAxis->setLabelsBrush(*m_labelBrush); |
|
780 | m_angularAxis->setLabelsBrush(*m_labelBrush); | |
781 | m_angularAxis->setLabelsPen(*m_labelPen); |
|
781 | m_angularAxis->setLabelsPen(*m_labelPen); | |
782 | m_angularAxis->setLabelsVisible(m_labelsVisible); |
|
782 | m_angularAxis->setLabelsVisible(m_labelsVisible); | |
783 | } |
|
783 | } | |
784 |
|
784 | |||
785 | void MainWindow::titleIndexChanged(int index) |
|
785 | void MainWindow::titleIndexChanged(int index) | |
786 | { |
|
786 | { | |
787 | delete m_titleBrush; |
|
787 | delete m_titleBrush; | |
788 | delete m_titlePen; |
|
788 | delete m_titlePen; | |
789 |
|
789 | |||
790 | switch (index) { |
|
790 | switch (index) { | |
791 | case 0: |
|
791 | case 0: | |
792 | m_titleBrush = new QBrush(Qt::NoBrush); |
|
792 | m_titleBrush = new QBrush(Qt::NoBrush); | |
793 | m_titlePen = new QPen(Qt::NoPen); |
|
793 | m_titlePen = new QPen(Qt::NoPen); | |
794 | m_titleVisible = false; |
|
794 | m_titleVisible = false; | |
795 | m_angularTitle = QString(); |
|
795 | m_angularTitle = QString(); | |
796 | m_radialTitle = QString(); |
|
796 | m_radialTitle = QString(); | |
797 | break; |
|
797 | break; | |
798 | case 1: |
|
798 | case 1: | |
799 | m_titleBrush = new QBrush(Qt::NoBrush); |
|
799 | m_titleBrush = new QBrush(Qt::NoBrush); | |
800 | m_titlePen = new QPen(Qt::NoPen); |
|
800 | m_titlePen = new QPen(Qt::NoPen); | |
801 | m_titleVisible = true; |
|
801 | m_titleVisible = true; | |
802 | m_angularTitle = QString(); |
|
802 | m_angularTitle = QString(); | |
803 | m_radialTitle = QString(); |
|
803 | m_radialTitle = QString(); | |
804 | break; |
|
804 | break; | |
805 | case 2: |
|
805 | case 2: | |
806 | m_titleBrush = new QBrush(Qt::NoBrush); |
|
806 | m_titleBrush = new QBrush(Qt::NoBrush); | |
807 | m_titlePen = new QPen(Qt::NoPen); |
|
807 | m_titlePen = new QPen(Qt::NoPen); | |
808 | m_titleVisible = false; |
|
808 | m_titleVisible = false; | |
809 | m_angularTitle = QString("Invisible Ang. Title!"); |
|
809 | m_angularTitle = QString("Invisible Ang. Title!"); | |
810 | m_radialTitle = QString("Invisible Rad. Title!"); |
|
810 | m_radialTitle = QString("Invisible Rad. Title!"); | |
811 | break; |
|
811 | break; | |
812 | case 3: |
|
812 | case 3: | |
813 | m_titleBrush = new QBrush(Qt::black); |
|
813 | m_titleBrush = new QBrush(Qt::black); | |
814 | m_titlePen = new QPen(Qt::NoPen); |
|
814 | m_titlePen = new QPen(Qt::NoPen); | |
815 | m_titleVisible = true; |
|
815 | m_titleVisible = true; | |
816 | m_angularTitle = QString("Angular Title"); |
|
816 | m_angularTitle = QString("Angular Title"); | |
817 | m_radialTitle = QString("Radial Title"); |
|
817 | m_radialTitle = QString("Radial Title"); | |
818 | break; |
|
818 | break; | |
819 | case 4: |
|
819 | case 4: | |
820 | m_titleBrush = new QBrush(Qt::white); |
|
820 | m_titleBrush = new QBrush(Qt::white); | |
821 | m_titlePen = new QPen(Qt::blue); |
|
821 | m_titlePen = new QPen(Qt::blue); | |
822 | m_titleVisible = true; |
|
822 | m_titleVisible = true; | |
823 | m_angularTitle = QString("Angular Blue Title"); |
|
823 | m_angularTitle = QString("Angular Blue Title"); | |
824 | m_radialTitle = QString("Radial Blue Title"); |
|
824 | m_radialTitle = QString("Radial Blue Title"); | |
825 | break; |
|
825 | break; | |
826 | default: |
|
826 | default: | |
827 | break; |
|
827 | break; | |
828 | } |
|
828 | } | |
829 |
|
829 | |||
830 | m_radialAxis->setTitleBrush(*m_titleBrush); |
|
830 | m_radialAxis->setTitleBrush(*m_titleBrush); | |
831 | m_radialAxis->setTitlePen(*m_titlePen); |
|
831 | m_radialAxis->setTitlePen(*m_titlePen); | |
832 | m_radialAxis->setTitleVisible(m_titleVisible); |
|
832 | m_radialAxis->setTitleVisible(m_titleVisible); | |
833 | m_radialAxis->setTitleText(m_radialTitle); |
|
833 | m_radialAxis->setTitleText(m_radialTitle); | |
834 | m_angularAxis->setTitleBrush(*m_titleBrush); |
|
834 | m_angularAxis->setTitleBrush(*m_titleBrush); | |
835 | m_angularAxis->setTitlePen(*m_titlePen); |
|
835 | m_angularAxis->setTitlePen(*m_titlePen); | |
836 | m_angularAxis->setTitleVisible(m_titleVisible); |
|
836 | m_angularAxis->setTitleVisible(m_titleVisible); | |
837 | m_angularAxis->setTitleText(m_angularTitle); |
|
837 | m_angularAxis->setTitleText(m_angularTitle); | |
838 | } |
|
838 | } | |
839 |
|
839 | |||
840 | void MainWindow::titleFontChanged(const QFont &font) |
|
840 | void MainWindow::titleFontChanged(const QFont &font) | |
841 | { |
|
841 | { | |
842 | m_currentTitleFont = font; |
|
842 | m_currentTitleFont = font; | |
843 | m_currentTitleFont.setPixelSize(ui->titleFontSizeSpin->value()); |
|
843 | m_currentTitleFont.setPixelSize(ui->titleFontSizeSpin->value()); | |
844 | m_angularAxis->setTitleFont(m_currentTitleFont); |
|
844 | m_angularAxis->setTitleFont(m_currentTitleFont); | |
845 | m_radialAxis->setTitleFont(m_currentTitleFont); |
|
845 | m_radialAxis->setTitleFont(m_currentTitleFont); | |
846 | } |
|
846 | } | |
847 |
|
847 | |||
848 | void MainWindow::titleFontSizeChanged(int value) |
|
848 | void MainWindow::titleFontSizeChanged(int value) | |
849 | { |
|
849 | { | |
850 | m_currentTitleFont = ui->titleFontComboBox->currentFont(); |
|
850 | m_currentTitleFont = ui->titleFontComboBox->currentFont(); | |
851 | m_currentTitleFont.setPixelSize(value); |
|
851 | m_currentTitleFont.setPixelSize(value); | |
852 | m_angularAxis->setTitleFont(m_currentTitleFont); |
|
852 | m_angularAxis->setTitleFont(m_currentTitleFont); | |
853 | m_radialAxis->setTitleFont(m_currentTitleFont); |
|
853 | m_radialAxis->setTitleFont(m_currentTitleFont); | |
854 | } |
|
854 | } | |
855 |
|
855 | |||
856 | void MainWindow::gridIndexChanged(int index) |
|
856 | void MainWindow::gridIndexChanged(int index) | |
857 | { |
|
857 | { | |
858 | delete m_gridPen; |
|
858 | delete m_gridPen; | |
859 |
|
859 | |||
860 | switch (index) { |
|
860 | switch (index) { | |
861 | case 0: |
|
861 | case 0: | |
862 | m_gridPen = new QPen(Qt::NoPen); |
|
862 | m_gridPen = new QPen(Qt::NoPen); | |
863 | m_gridVisible = false; |
|
863 | m_gridVisible = false; | |
864 | break; |
|
864 | break; | |
865 | case 1: |
|
865 | case 1: | |
866 | m_gridPen = new QPen(Qt::black); |
|
866 | m_gridPen = new QPen(Qt::black); | |
867 | m_gridVisible = true; |
|
867 | m_gridVisible = true; | |
868 | break; |
|
868 | break; | |
869 | case 2: |
|
869 | case 2: | |
870 | m_gridPen = new QPen(Qt::red); |
|
870 | m_gridPen = new QPen(Qt::red); | |
871 | m_gridPen->setStyle(Qt::DashDotLine); |
|
871 | m_gridPen->setStyle(Qt::DashDotLine); | |
872 | m_gridPen->setWidth(3); |
|
872 | m_gridPen->setWidth(3); | |
873 | m_gridVisible = true; |
|
873 | m_gridVisible = true; | |
874 | break; |
|
874 | break; | |
875 | default: |
|
875 | default: | |
876 | break; |
|
876 | break; | |
877 | } |
|
877 | } | |
878 |
|
878 | |||
879 | m_angularAxis->setGridLinePen(*m_gridPen); |
|
879 | m_angularAxis->setGridLinePen(*m_gridPen); | |
880 | m_angularAxis->setGridLineVisible(m_gridVisible); |
|
880 | m_angularAxis->setGridLineVisible(m_gridVisible); | |
881 | m_radialAxis->setGridLinePen(*m_gridPen); |
|
881 | m_radialAxis->setGridLinePen(*m_gridPen); | |
882 | m_radialAxis->setGridLineVisible(m_gridVisible); |
|
882 | m_radialAxis->setGridLineVisible(m_gridVisible); | |
883 | } |
|
883 | } | |
884 |
|
884 | |||
885 | void MainWindow::arrowIndexChanged(int index) |
|
885 | void MainWindow::arrowIndexChanged(int index) | |
886 | { |
|
886 | { | |
887 | delete m_arrowPen; |
|
887 | delete m_arrowPen; | |
888 |
|
888 | |||
889 | switch (index) { |
|
889 | switch (index) { | |
890 | case 0: |
|
890 | case 0: | |
891 | m_arrowPen = new QPen(Qt::NoPen); |
|
891 | m_arrowPen = new QPen(Qt::NoPen); | |
892 | m_arrowVisible = false; |
|
892 | m_arrowVisible = false; | |
893 | break; |
|
893 | break; | |
894 | case 1: |
|
894 | case 1: | |
895 | m_arrowPen = new QPen(Qt::black); |
|
895 | m_arrowPen = new QPen(Qt::black); | |
896 | m_arrowVisible = true; |
|
896 | m_arrowVisible = true; | |
897 | break; |
|
897 | break; | |
898 | case 2: |
|
898 | case 2: | |
899 | m_arrowPen = new QPen(Qt::red); |
|
899 | m_arrowPen = new QPen(Qt::red); | |
900 | m_arrowPen->setStyle(Qt::DashDotLine); |
|
900 | m_arrowPen->setStyle(Qt::DashDotLine); | |
901 | m_arrowPen->setWidth(3); |
|
901 | m_arrowPen->setWidth(3); | |
902 | m_arrowVisible = true; |
|
902 | m_arrowVisible = true; | |
903 | break; |
|
903 | break; | |
904 | default: |
|
904 | default: | |
905 | break; |
|
905 | break; | |
906 | } |
|
906 | } | |
907 |
|
907 | |||
908 | m_angularAxis->setLinePen(*m_arrowPen); |
|
908 | m_angularAxis->setLinePen(*m_arrowPen); | |
909 | m_angularAxis->setLineVisible(m_arrowVisible); |
|
909 | m_angularAxis->setLineVisible(m_arrowVisible); | |
910 | m_radialAxis->setLinePen(*m_arrowPen); |
|
910 | m_radialAxis->setLinePen(*m_arrowPen); | |
911 | m_radialAxis->setLineVisible(m_arrowVisible); |
|
911 | m_radialAxis->setLineVisible(m_arrowVisible); | |
912 | } |
|
912 | } | |
913 |
|
913 | |||
914 | void MainWindow::angularRangeChanged(qreal min, qreal max) |
|
914 | void MainWindow::angularRangeChanged(qreal min, qreal max) | |
915 | { |
|
915 | { | |
916 | if (!qFuzzyCompare(ui->angularMinSpin->value(), min)) |
|
916 | if (!qFuzzyCompare(qreal(ui->angularMinSpin->value()), min)) | |
917 | ui->angularMinSpin->setValue(min); |
|
917 | ui->angularMinSpin->setValue(min); | |
918 | if (!qFuzzyCompare(ui->angularMaxSpin->value(), max)) |
|
918 | if (!qFuzzyCompare(qreal(ui->angularMaxSpin->value()), max)) | |
919 | ui->angularMaxSpin->setValue(max); |
|
919 | ui->angularMaxSpin->setValue(max); | |
920 | } |
|
920 | } | |
921 |
|
921 | |||
922 | void MainWindow::radialRangeChanged(qreal min, qreal max) |
|
922 | void MainWindow::radialRangeChanged(qreal min, qreal max) | |
923 | { |
|
923 | { | |
924 | if (!qFuzzyCompare(ui->radialMinSpin->value(), min)) |
|
924 | if (!qFuzzyCompare(qreal(ui->radialMinSpin->value()), min)) | |
925 | ui->radialMinSpin->setValue(min); |
|
925 | ui->radialMinSpin->setValue(min); | |
926 | if (!qFuzzyCompare(ui->radialMaxSpin->value(), max)) |
|
926 | if (!qFuzzyCompare(qreal(ui->radialMaxSpin->value()), max)) | |
927 | ui->radialMaxSpin->setValue(max); |
|
927 | ui->radialMaxSpin->setValue(max); | |
928 | } |
|
928 | } | |
929 |
|
929 | |||
930 | void MainWindow::angularAxisIndexChanged(int index) |
|
930 | void MainWindow::angularAxisIndexChanged(int index) | |
931 | { |
|
931 | { | |
932 | switch (index) { |
|
932 | switch (index) { | |
933 | case 0: |
|
933 | case 0: | |
934 | setAngularAxis(AxisModeNone); |
|
934 | setAngularAxis(AxisModeNone); | |
935 | break; |
|
935 | break; | |
936 | case 1: |
|
936 | case 1: | |
937 | setAngularAxis(AxisModeValue); |
|
937 | setAngularAxis(AxisModeValue); | |
938 | break; |
|
938 | break; | |
939 | case 2: |
|
939 | case 2: | |
940 | setAngularAxis(AxisModeLogValue); |
|
940 | setAngularAxis(AxisModeLogValue); | |
941 | break; |
|
941 | break; | |
942 | case 3: |
|
942 | case 3: | |
943 | setAngularAxis(AxisModeDateTime); |
|
943 | setAngularAxis(AxisModeDateTime); | |
944 | break; |
|
944 | break; | |
945 | case 4: |
|
945 | case 4: | |
946 | setAngularAxis(AxisModeCategory); |
|
946 | setAngularAxis(AxisModeCategory); | |
947 | break; |
|
947 | break; | |
948 | default: |
|
948 | default: | |
949 | qWarning("Invalid Index!"); |
|
949 | qWarning("Invalid Index!"); | |
950 | } |
|
950 | } | |
951 | } |
|
951 | } | |
952 |
|
952 | |||
953 | void MainWindow::radialAxisIndexChanged(int index) |
|
953 | void MainWindow::radialAxisIndexChanged(int index) | |
954 | { |
|
954 | { | |
955 | switch (index) { |
|
955 | switch (index) { | |
956 | case 0: |
|
956 | case 0: | |
957 | setRadialAxis(AxisModeNone); |
|
957 | setRadialAxis(AxisModeNone); | |
958 | break; |
|
958 | break; | |
959 | case 1: |
|
959 | case 1: | |
960 | setRadialAxis(AxisModeValue); |
|
960 | setRadialAxis(AxisModeValue); | |
961 | break; |
|
961 | break; | |
962 | case 2: |
|
962 | case 2: | |
963 | setRadialAxis(AxisModeLogValue); |
|
963 | setRadialAxis(AxisModeLogValue); | |
964 | break; |
|
964 | break; | |
965 | case 3: |
|
965 | case 3: | |
966 | setRadialAxis(AxisModeDateTime); |
|
966 | setRadialAxis(AxisModeDateTime); | |
967 | break; |
|
967 | break; | |
968 | case 4: |
|
968 | case 4: | |
969 | setRadialAxis(AxisModeCategory); |
|
969 | setRadialAxis(AxisModeCategory); | |
970 | break; |
|
970 | break; | |
971 | default: |
|
971 | default: | |
972 | qWarning("Invalid Index!"); |
|
972 | qWarning("Invalid Index!"); | |
973 | } |
|
973 | } | |
974 | } |
|
974 | } | |
975 |
|
975 | |||
976 | void MainWindow::logBaseChanged(double value) |
|
976 | void MainWindow::logBaseChanged(double value) | |
977 | { |
|
977 | { | |
978 | m_base = value; |
|
978 | m_base = value; | |
979 | if (m_angularAxisMode == AxisModeLogValue) |
|
979 | if (m_angularAxisMode == AxisModeLogValue) | |
980 | static_cast<QLogValueAxis *>(m_angularAxis)->setBase(m_base); |
|
980 | static_cast<QLogValueAxis *>(m_angularAxis)->setBase(m_base); | |
981 | if (m_radialAxisMode == AxisModeLogValue) |
|
981 | if (m_radialAxisMode == AxisModeLogValue) | |
982 | static_cast<QLogValueAxis *>(m_radialAxis)->setBase(m_base); |
|
982 | static_cast<QLogValueAxis *>(m_radialAxis)->setBase(m_base); | |
983 | } |
|
983 | } | |
984 |
|
984 | |||
985 | void MainWindow::niceNumbersChecked() |
|
985 | void MainWindow::niceNumbersChecked() | |
986 | { |
|
986 | { | |
987 | if (ui->niceNumbersCheckBox->isChecked()) |
|
987 | if (ui->niceNumbersCheckBox->isChecked()) | |
988 | applyRanges(); |
|
988 | applyRanges(); | |
989 | } |
|
989 | } | |
990 |
|
990 | |||
991 | void MainWindow::dateFormatEdited(const QString &text) |
|
991 | void MainWindow::dateFormatEdited(const QString &text) | |
992 | { |
|
992 | { | |
993 | m_dateFormat = text; |
|
993 | m_dateFormat = text; | |
994 | if (m_angularAxisMode == AxisModeDateTime) |
|
994 | if (m_angularAxisMode == AxisModeDateTime) | |
995 | static_cast<QDateTimeAxis *>(m_angularAxis)->setFormat(m_dateFormat); |
|
995 | static_cast<QDateTimeAxis *>(m_angularAxis)->setFormat(m_dateFormat); | |
996 | if (m_radialAxisMode == AxisModeDateTime) |
|
996 | if (m_radialAxisMode == AxisModeDateTime) | |
997 | static_cast<QDateTimeAxis *>(m_radialAxis)->setFormat(m_dateFormat); |
|
997 | static_cast<QDateTimeAxis *>(m_radialAxis)->setFormat(m_dateFormat); | |
998 | } |
|
998 | } | |
999 |
|
999 | |||
1000 | void MainWindow::moreCategoriesChecked() |
|
1000 | void MainWindow::moreCategoriesChecked() | |
1001 | { |
|
1001 | { | |
1002 | applyCategories(); |
|
1002 | applyCategories(); | |
1003 | m_moreCategories = ui->moreCategoriesCheckBox->isChecked(); |
|
1003 | m_moreCategories = ui->moreCategoriesCheckBox->isChecked(); | |
1004 | } |
|
1004 | } | |
1005 |
|
1005 | |||
1006 | void MainWindow::series1CheckBoxChecked() |
|
1006 | void MainWindow::series1CheckBoxChecked() | |
1007 | { |
|
1007 | { | |
1008 | if (ui->series1checkBox->isChecked()) |
|
1008 | if (ui->series1checkBox->isChecked()) | |
1009 | m_series1->setVisible(true); |
|
1009 | m_series1->setVisible(true); | |
1010 | else |
|
1010 | else | |
1011 | m_series1->setVisible(false); |
|
1011 | m_series1->setVisible(false); | |
1012 | } |
|
1012 | } | |
1013 |
|
1013 | |||
1014 | void MainWindow::series2CheckBoxChecked() |
|
1014 | void MainWindow::series2CheckBoxChecked() | |
1015 | { |
|
1015 | { | |
1016 | if (ui->series2checkBox->isChecked()) |
|
1016 | if (ui->series2checkBox->isChecked()) | |
1017 | m_series2->setVisible(true); |
|
1017 | m_series2->setVisible(true); | |
1018 | else |
|
1018 | else | |
1019 | m_series2->setVisible(false); |
|
1019 | m_series2->setVisible(false); | |
1020 | } |
|
1020 | } | |
1021 |
|
1021 | |||
1022 | void MainWindow::series3CheckBoxChecked() |
|
1022 | void MainWindow::series3CheckBoxChecked() | |
1023 | { |
|
1023 | { | |
1024 | if (ui->series3checkBox->isChecked()) |
|
1024 | if (ui->series3checkBox->isChecked()) | |
1025 | m_series3->setVisible(true); |
|
1025 | m_series3->setVisible(true); | |
1026 | else |
|
1026 | else | |
1027 | m_series3->setVisible(false); |
|
1027 | m_series3->setVisible(false); | |
1028 | } |
|
1028 | } | |
1029 |
|
1029 | |||
1030 | void MainWindow::series4CheckBoxChecked() |
|
1030 | void MainWindow::series4CheckBoxChecked() | |
1031 | { |
|
1031 | { | |
1032 | if (ui->series4checkBox->isChecked()) |
|
1032 | if (ui->series4checkBox->isChecked()) | |
1033 | m_series4->setVisible(true); |
|
1033 | m_series4->setVisible(true); | |
1034 | else |
|
1034 | else | |
1035 | m_series4->setVisible(false); |
|
1035 | m_series4->setVisible(false); | |
1036 | } |
|
1036 | } | |
1037 |
|
1037 | |||
1038 | void MainWindow::series5CheckBoxChecked() |
|
1038 | void MainWindow::series5CheckBoxChecked() | |
1039 | { |
|
1039 | { | |
1040 | if (ui->series5checkBox->isChecked()) |
|
1040 | if (ui->series5checkBox->isChecked()) | |
1041 | m_series5->setVisible(true); |
|
1041 | m_series5->setVisible(true); | |
1042 | else |
|
1042 | else | |
1043 | m_series5->setVisible(false); |
|
1043 | m_series5->setVisible(false); | |
1044 | } |
|
1044 | } | |
1045 |
|
1045 | |||
1046 | void MainWindow::series6CheckBoxChecked() |
|
1046 | void MainWindow::series6CheckBoxChecked() | |
1047 | { |
|
1047 | { | |
1048 | if (ui->series6checkBox->isChecked()) |
|
1048 | if (ui->series6checkBox->isChecked()) | |
1049 | m_series6->setVisible(true); |
|
1049 | m_series6->setVisible(true); | |
1050 | else |
|
1050 | else | |
1051 | m_series6->setVisible(false); |
|
1051 | m_series6->setVisible(false); | |
1052 | } |
|
1052 | } | |
1053 |
|
1053 | |||
1054 | void MainWindow::series7CheckBoxChecked() |
|
1054 | void MainWindow::series7CheckBoxChecked() | |
1055 | { |
|
1055 | { | |
1056 | if (ui->series7checkBox->isChecked()) |
|
1056 | if (ui->series7checkBox->isChecked()) | |
1057 | m_series7->setVisible(true); |
|
1057 | m_series7->setVisible(true); | |
1058 | else |
|
1058 | else | |
1059 | m_series7->setVisible(false); |
|
1059 | m_series7->setVisible(false); | |
1060 | } |
|
1060 | } | |
1061 |
|
1061 | |||
1062 | void MainWindow::themeIndexChanged(int index) |
|
1062 | void MainWindow::themeIndexChanged(int index) | |
1063 | { |
|
1063 | { | |
1064 | m_chart->setTheme(QChart::ChartTheme(index)); |
|
1064 | m_chart->setTheme(QChart::ChartTheme(index)); | |
1065 | } |
|
1065 | } | |
1066 |
|
1066 | |||
1067 | void MainWindow::seriesHovered(QPointF point, bool state) |
|
1067 | void MainWindow::seriesHovered(QPointF point, bool state) | |
1068 | { |
|
1068 | { | |
1069 | QAbstractSeries *series = qobject_cast<QAbstractSeries *>(sender()); |
|
1069 | QAbstractSeries *series = qobject_cast<QAbstractSeries *>(sender()); | |
1070 | if (series) { |
|
1070 | if (series) { | |
1071 | if (state) { |
|
1071 | if (state) { | |
1072 | QString str("'%3' - %1 x %2"); |
|
1072 | QString str("'%3' - %1 x %2"); | |
1073 | ui->hoverLabel->setText(str.arg(point.x()).arg(point.y()).arg(series->name())); |
|
1073 | ui->hoverLabel->setText(str.arg(point.x()).arg(point.y()).arg(series->name())); | |
1074 | } else { |
|
1074 | } else { | |
1075 | ui->hoverLabel->setText("No hover"); |
|
1075 | ui->hoverLabel->setText("No hover"); | |
1076 | } |
|
1076 | } | |
1077 | } else { |
|
1077 | } else { | |
1078 | qDebug() << "seriesHovered - invalid sender!"; |
|
1078 | qDebug() << "seriesHovered - invalid sender!"; | |
1079 | } |
|
1079 | } | |
1080 | } |
|
1080 | } | |
1081 |
|
1081 | |||
1082 | void MainWindow::seriesClicked(const QPointF &point) |
|
1082 | void MainWindow::seriesClicked(const QPointF &point) | |
1083 | { |
|
1083 | { | |
1084 | QAbstractSeries *series = qobject_cast<QAbstractSeries *>(sender()); |
|
1084 | QAbstractSeries *series = qobject_cast<QAbstractSeries *>(sender()); | |
1085 | if (series) { |
|
1085 | if (series) { | |
1086 | QString str("'%3' clicked at: %1 x %2"); |
|
1086 | QString str("'%3' clicked at: %1 x %2"); | |
1087 | m_angularTitle = str.arg(point.x()).arg(point.y()).arg(series->name()); |
|
1087 | m_angularTitle = str.arg(point.x()).arg(point.y()).arg(series->name()); | |
1088 | m_angularAxis->setTitleText(m_angularTitle); |
|
1088 | m_angularAxis->setTitleText(m_angularTitle); | |
1089 | } else { |
|
1089 | } else { | |
1090 | qDebug() << "seriesClicked - invalid sender!"; |
|
1090 | qDebug() << "seriesClicked - invalid sender!"; | |
1091 | } |
|
1091 | } | |
1092 | } |
|
1092 | } | |
1093 |
|
1093 | |||
1094 | void MainWindow::backgroundIndexChanged(int index) |
|
1094 | void MainWindow::backgroundIndexChanged(int index) | |
1095 | { |
|
1095 | { | |
1096 | delete m_backgroundBrush; |
|
1096 | delete m_backgroundBrush; | |
1097 | delete m_backgroundPen; |
|
1097 | delete m_backgroundPen; | |
1098 |
|
1098 | |||
1099 | switch (index) { |
|
1099 | switch (index) { | |
1100 | case 0: |
|
1100 | case 0: | |
1101 | m_backgroundBrush = new QBrush(Qt::white); |
|
1101 | m_backgroundBrush = new QBrush(Qt::white); | |
1102 | m_backgroundPen = new QPen(Qt::NoPen); |
|
1102 | m_backgroundPen = new QPen(Qt::NoPen); | |
1103 | break; |
|
1103 | break; | |
1104 | case 1: |
|
1104 | case 1: | |
1105 | m_backgroundBrush = new QBrush(Qt::blue); |
|
1105 | m_backgroundBrush = new QBrush(Qt::blue); | |
1106 | m_backgroundPen = new QPen(Qt::NoPen); |
|
1106 | m_backgroundPen = new QPen(Qt::NoPen); | |
1107 | break; |
|
1107 | break; | |
1108 | case 2: |
|
1108 | case 2: | |
1109 | m_backgroundBrush = new QBrush(Qt::yellow); |
|
1109 | m_backgroundBrush = new QBrush(Qt::yellow); | |
1110 | m_backgroundPen = new QPen(Qt::black, 2); |
|
1110 | m_backgroundPen = new QPen(Qt::black, 2); | |
1111 | break; |
|
1111 | break; | |
1112 | default: |
|
1112 | default: | |
1113 | break; |
|
1113 | break; | |
1114 | } |
|
1114 | } | |
1115 | m_chart->setBackgroundBrush(*m_backgroundBrush); |
|
1115 | m_chart->setBackgroundBrush(*m_backgroundBrush); | |
1116 | m_chart->setBackgroundPen(*m_backgroundPen); |
|
1116 | m_chart->setBackgroundPen(*m_backgroundPen); | |
1117 | } |
|
1117 | } | |
1118 |
|
1118 | |||
1119 | void MainWindow::plotAreaIndexChanged(int index) |
|
1119 | void MainWindow::plotAreaIndexChanged(int index) | |
1120 | { |
|
1120 | { | |
1121 | delete m_plotAreaBackgroundBrush; |
|
1121 | delete m_plotAreaBackgroundBrush; | |
1122 | delete m_plotAreaBackgroundPen; |
|
1122 | delete m_plotAreaBackgroundPen; | |
1123 |
|
1123 | |||
1124 | switch (index) { |
|
1124 | switch (index) { | |
1125 | case 0: |
|
1125 | case 0: | |
1126 | m_plotAreaBackgroundBrush = new QBrush(Qt::green); |
|
1126 | m_plotAreaBackgroundBrush = new QBrush(Qt::green); | |
1127 | m_plotAreaBackgroundPen = new QPen(Qt::green); |
|
1127 | m_plotAreaBackgroundPen = new QPen(Qt::green); | |
1128 | m_chart->setPlotAreaBackgroundVisible(false); |
|
1128 | m_chart->setPlotAreaBackgroundVisible(false); | |
1129 | break; |
|
1129 | break; | |
1130 | case 1: |
|
1130 | case 1: | |
1131 | m_plotAreaBackgroundBrush = new QBrush(Qt::magenta); |
|
1131 | m_plotAreaBackgroundBrush = new QBrush(Qt::magenta); | |
1132 | m_plotAreaBackgroundPen = new QPen(Qt::NoPen); |
|
1132 | m_plotAreaBackgroundPen = new QPen(Qt::NoPen); | |
1133 | m_chart->setPlotAreaBackgroundVisible(true); |
|
1133 | m_chart->setPlotAreaBackgroundVisible(true); | |
1134 | break; |
|
1134 | break; | |
1135 | case 2: |
|
1135 | case 2: | |
1136 | m_plotAreaBackgroundBrush = new QBrush(Qt::lightGray); |
|
1136 | m_plotAreaBackgroundBrush = new QBrush(Qt::lightGray); | |
1137 | m_plotAreaBackgroundPen = new QPen(Qt::red, 6); |
|
1137 | m_plotAreaBackgroundPen = new QPen(Qt::red, 6); | |
1138 | m_chart->setPlotAreaBackgroundVisible(true); |
|
1138 | m_chart->setPlotAreaBackgroundVisible(true); | |
1139 | break; |
|
1139 | break; | |
1140 | default: |
|
1140 | default: | |
1141 | break; |
|
1141 | break; | |
1142 | } |
|
1142 | } | |
1143 | m_chart->setPlotAreaBackgroundBrush(*m_plotAreaBackgroundBrush); |
|
1143 | m_chart->setPlotAreaBackgroundBrush(*m_plotAreaBackgroundBrush); | |
1144 | m_chart->setPlotAreaBackgroundPen(*m_plotAreaBackgroundPen); |
|
1144 | m_chart->setPlotAreaBackgroundPen(*m_plotAreaBackgroundPen); | |
1145 | } |
|
1145 | } | |
1146 |
|
1146 | |||
1147 | void MainWindow::applyCategories() |
|
1147 | void MainWindow::applyCategories() | |
1148 | { |
|
1148 | { | |
1149 | // Basic layout is three categories, extended has five |
|
1149 | // Basic layout is three categories, extended has five | |
1150 | if (m_angularAxisMode == AxisModeCategory) { |
|
1150 | if (m_angularAxisMode == AxisModeCategory) { | |
1151 | QCategoryAxis *angCatAxis = static_cast<QCategoryAxis *>(m_angularAxis); |
|
1151 | QCategoryAxis *angCatAxis = static_cast<QCategoryAxis *>(m_angularAxis); | |
1152 | if (angCatAxis->count() == 0) { |
|
1152 | if (angCatAxis->count() == 0) { | |
1153 | angCatAxis->setStartValue(4000); |
|
1153 | angCatAxis->setStartValue(4000); | |
1154 | angCatAxis->append("Category A", 7000); |
|
1154 | angCatAxis->append("Category A", 7000); | |
1155 | angCatAxis->append("Category B", 12000); |
|
1155 | angCatAxis->append("Category B", 12000); | |
1156 | angCatAxis->append("Category C", 17000); |
|
1156 | angCatAxis->append("Category C", 17000); | |
1157 | } |
|
1157 | } | |
1158 | if (angCatAxis->count() == 3 && ui->moreCategoriesCheckBox->isChecked()) { |
|
1158 | if (angCatAxis->count() == 3 && ui->moreCategoriesCheckBox->isChecked()) { | |
1159 | angCatAxis->setStartValue(1000); |
|
1159 | angCatAxis->setStartValue(1000); | |
1160 | angCatAxis->replaceLabel("Category A", "Cat A"); |
|
1160 | angCatAxis->replaceLabel("Category A", "Cat A"); | |
1161 | angCatAxis->replaceLabel("Category B", "Cat B"); |
|
1161 | angCatAxis->replaceLabel("Category B", "Cat B"); | |
1162 | angCatAxis->replaceLabel("Category C", "Cat C"); |
|
1162 | angCatAxis->replaceLabel("Category C", "Cat C"); | |
1163 | angCatAxis->append("Cat D", 22000); |
|
1163 | angCatAxis->append("Cat D", 22000); | |
1164 | angCatAxis->append("Cat E", 28000); |
|
1164 | angCatAxis->append("Cat E", 28000); | |
1165 | } else if (angCatAxis->count() == 5 && !ui->moreCategoriesCheckBox->isChecked()) { |
|
1165 | } else if (angCatAxis->count() == 5 && !ui->moreCategoriesCheckBox->isChecked()) { | |
1166 | angCatAxis->setStartValue(4000); |
|
1166 | angCatAxis->setStartValue(4000); | |
1167 | angCatAxis->replaceLabel("Cat A", "Category A"); |
|
1167 | angCatAxis->replaceLabel("Cat A", "Category A"); | |
1168 | angCatAxis->replaceLabel("Cat B", "Category B"); |
|
1168 | angCatAxis->replaceLabel("Cat B", "Category B"); | |
1169 | angCatAxis->replaceLabel("Cat C", "Category C"); |
|
1169 | angCatAxis->replaceLabel("Cat C", "Category C"); | |
1170 | angCatAxis->remove("Cat D"); |
|
1170 | angCatAxis->remove("Cat D"); | |
1171 | angCatAxis->remove("Cat E"); |
|
1171 | angCatAxis->remove("Cat E"); | |
1172 | } |
|
1172 | } | |
1173 | } |
|
1173 | } | |
1174 |
|
1174 | |||
1175 | if (m_radialAxisMode == AxisModeCategory) { |
|
1175 | if (m_radialAxisMode == AxisModeCategory) { | |
1176 | QCategoryAxis *radCatAxis = static_cast<QCategoryAxis *>(m_radialAxis); |
|
1176 | QCategoryAxis *radCatAxis = static_cast<QCategoryAxis *>(m_radialAxis); | |
1177 | if (radCatAxis->count() == 0) { |
|
1177 | if (radCatAxis->count() == 0) { | |
1178 | radCatAxis->setStartValue(2000); |
|
1178 | radCatAxis->setStartValue(2000); | |
1179 | radCatAxis->append("Category 1", 4000); |
|
1179 | radCatAxis->append("Category 1", 4000); | |
1180 | radCatAxis->append("Category 2", 9000); |
|
1180 | radCatAxis->append("Category 2", 9000); | |
1181 | radCatAxis->append("Category 3", 14000); |
|
1181 | radCatAxis->append("Category 3", 14000); | |
1182 | } |
|
1182 | } | |
1183 | if (radCatAxis->count() == 3 && ui->moreCategoriesCheckBox->isChecked()) { |
|
1183 | if (radCatAxis->count() == 3 && ui->moreCategoriesCheckBox->isChecked()) { | |
1184 | radCatAxis->setStartValue(1000); |
|
1184 | radCatAxis->setStartValue(1000); | |
1185 | radCatAxis->replaceLabel("Category 1", "Cat 1"); |
|
1185 | radCatAxis->replaceLabel("Category 1", "Cat 1"); | |
1186 | radCatAxis->replaceLabel("Category 2", "Cat 2"); |
|
1186 | radCatAxis->replaceLabel("Category 2", "Cat 2"); | |
1187 | radCatAxis->replaceLabel("Category 3", "Cat 3"); |
|
1187 | radCatAxis->replaceLabel("Category 3", "Cat 3"); | |
1188 | radCatAxis->append("Cat 4", 16500); |
|
1188 | radCatAxis->append("Cat 4", 16500); | |
1189 | radCatAxis->append("Cat 5", 19000); |
|
1189 | radCatAxis->append("Cat 5", 19000); | |
1190 | } else if (radCatAxis->count() == 5 && !ui->moreCategoriesCheckBox->isChecked()) { |
|
1190 | } else if (radCatAxis->count() == 5 && !ui->moreCategoriesCheckBox->isChecked()) { | |
1191 | radCatAxis->setStartValue(2000); |
|
1191 | radCatAxis->setStartValue(2000); | |
1192 | radCatAxis->replaceLabel("Cat 1", "Category 1"); |
|
1192 | radCatAxis->replaceLabel("Cat 1", "Category 1"); | |
1193 | radCatAxis->replaceLabel("Cat 2", "Category 2"); |
|
1193 | radCatAxis->replaceLabel("Cat 2", "Category 2"); | |
1194 | radCatAxis->replaceLabel("Cat 3", "Category 3"); |
|
1194 | radCatAxis->replaceLabel("Cat 3", "Category 3"); | |
1195 | radCatAxis->remove("Cat 4"); |
|
1195 | radCatAxis->remove("Cat 4"); | |
1196 | radCatAxis->remove("Cat 5"); |
|
1196 | radCatAxis->remove("Cat 5"); | |
1197 | } |
|
1197 | } | |
1198 | } |
|
1198 | } | |
1199 | } |
|
1199 | } |
General Comments 0
You need to be logged in to leave comments.
Login now