##// END OF EJS Templates
QML PieSlice documentation
Tero Ahola -
r1470:048f828e9404
parent child
Show More
@@ -6,6 +6,8
6 QtCommercial Charts QML API is an intuitive and simple way to show charts in your QML
6 QtCommercial Charts QML API is an intuitive and simple way to show charts in your QML
7 applications. The following example QML shows you how to create a simple pie chart:
7 applications. The following example QML shows you how to create a simple pie chart:
8 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 1
8 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 1
9 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 2
10 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 3
9
11
10 \beginfloatleft
12 \beginfloatleft
11 \image examples_qmlpiechart.png
13 \image examples_qmlpiechart.png
@@ -39,6 +39,22 QTCOMMERCIALCHART_BEGIN_NAMESPACE
39 */
39 */
40
40
41 /*!
41 /*!
42 \qmlclass PieSlice QPieSlice
43 PieSlice defines the properties of a single slice in a PieSeries. The element should be used
44 as a child for a PieSeries. For example:
45 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 2
46
47 An alternative (dynamic) method for adding slices to a PieSeries is using PieSeries.append
48 method.
49 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 4
50
51 In that case you may want to use PieSeries.at or PieSeries.find to access the properties of
52 an individual PieSlice instance.
53 \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 5
54 \sa PieSeries
55 */
56
57 /*!
42 \enum QPieSlice::LabelPosition
58 \enum QPieSlice::LabelPosition
43
59
44 This enum describes the position of the slice label.
60 This enum describes the position of the slice label.
@@ -50,342 +66,405 QTCOMMERCIALCHART_BEGIN_NAMESPACE
50
66
51 /*!
67 /*!
52 \property QPieSlice::label
68 \property QPieSlice::label
53
54 Label of the slice.
69 Label of the slice.
55
56 \sa labelVisible, labelBrush, labelFont, labelArmLengthFactor
70 \sa labelVisible, labelBrush, labelFont, labelArmLengthFactor
57 */
71 */
72 /*!
73 \qmlproperty string PieSlice::label
74 Label (text) of the slice.
75 */
58
76
59 /*!
77 /*!
60 \fn void QPieSlice::labelChanged()
78 \fn void QPieSlice::labelChanged()
61
62 This signal emitted when the slice label has been changed.
79 This signal emitted when the slice label has been changed.
63
80 \sa label
81 */
82 /*!
83 \qmlsignal PieSlice::labelChanged()
84 This signal emitted when the slice label has been changed.
64 \sa label
85 \sa label
65 */
86 */
66
87
67 /*!
88 /*!
68 \property QPieSlice::value
89 \property QPieSlice::value
69
70 Value of the slice.
90 Value of the slice.
71
72 Note that if users sets a negative value it is converted to a positive value.
91 Note that if users sets a negative value it is converted to a positive value.
73
74 \sa percentage(), QPieSeries::sum()
92 \sa percentage(), QPieSeries::sum()
75 */
93 */
94 /*!
95 \qmlproperty real PieSlice::value
96 Value of the slice. Note that if users sets a negative value it is converted to a positive value.
97 */
76
98
77 /*!
99 /*!
78 \fn void QPieSlice::valueChanged()
100 \fn void QPieSlice::valueChanged()
79
80 This signal is emitted when the slice value changes.
101 This signal is emitted when the slice value changes.
81
102 \sa value
103 */
104 /*!
105 \qmlsignal PieSlice::valueChanged()
106 This signal is emitted when the slice value changes.
82 \sa value
107 \sa value
83 */
108 */
84
109
85 /*!
110 /*!
86 \property QPieSlice::labelVisible
111 \property QPieSlice::labelVisible
87
112 Defines the visibility of slice label. By default the label is not visible.
88 Defienes the visibility of the slice label.
89
90 Default is not visible.
91
92 \sa label, labelBrush, labelFont, labelArmLengthFactor
113 \sa label, labelBrush, labelFont, labelArmLengthFactor
93 */
114 */
115 /*!
116 \qmlproperty bool PieSlice::labelVisible
117 Defines the visibility of slice label. By default the label is not visible.
118 */
94
119
95 /*!
120 /*!
96 \fn void QPieSlice::labelVisibleChanged()
121 \fn void QPieSlice::labelVisibleChanged()
97
98 This signal emitted when visibility of the slice label has changed.
122 This signal emitted when visibility of the slice label has changed.
99
123 \sa labelVisible
124 */
125 /*!
126 \qmlsignal PieSlice::labelVisibleChanged()
127 This signal emitted when visibility of the slice label has changed.
100 \sa labelVisible
128 \sa labelVisible
101 */
129 */
102
130
103 /*!
131 /*!
104 \property QPieSlice::exploded
132 \property QPieSlice::exploded
105
133 If set to true the slice is "exploded" away from the pie.
106 Defines if the slice is exploded from the pie.
134 \sa explodeDistanceFactor
107
135 */
136 /*!
137 \qmlproperty bool PieSlice::exploded
138 If set to true the slice is "exploded" away from the pie.
108 \sa explodeDistanceFactor
139 \sa explodeDistanceFactor
109 */
140 */
110
141
111 /*!
142 /*!
112 \fn void QPieSlice::explodedChanged()
143 \fn void QPieSlice::explodedChanged()
113
114 This signal is emitted the the slice has been exploded from the pie or is returned back to the pie.
144 This signal is emitted the the slice has been exploded from the pie or is returned back to the pie.
115
145 \sa exploded
146 */
147 /*!
148 \qmlsignal PieSlice::explodedChanged()
149 This signal is emitted the the slice has been exploded from the pie or is returned back to the pie.
116 \sa exploded
150 \sa exploded
117 */
151 */
118
152
119 /*!
153 /*!
120 \property QPieSlice::pen
154 \property QPieSlice::pen
121
122 Pen used to draw the slice border.
155 Pen used to draw the slice border.
123 */
156 */
124
157
125 /*!
158 /*!
126 \fn void QPieSlice::penChanged()
159 \fn void QPieSlice::penChanged()
127
128 This signal is emitted when the pen of the slice has changed.
160 This signal is emitted when the pen of the slice has changed.
129
130 \sa pen
161 \sa pen
131 */
162 */
132
163
133 /*!
164 /*!
134 \property QPieSlice::borderColor
165 \property QPieSlice::borderColor
135
136 Color used to draw the slice border.
166 Color used to draw the slice border.
137
138 This is a convenience property for modifying the slice pen.
167 This is a convenience property for modifying the slice pen.
139
140 \sa pen, borderWidth
168 \sa pen, borderWidth
141 */
169 */
170 /*!
171 \qmlproperty color PieSlice::borderColor
172 Color used to draw the slice border (pen color).
173 \sa borderWidth
174 */
142
175
143 /*!
176 /*!
144 \fn void QPieSlice::borderColorChanged()
177 \fn void QPieSlice::borderColorChanged()
145
146 This signal is emitted when slice border color changes.
178 This signal is emitted when slice border color changes.
147
148 \sa pen, borderColor
179 \sa pen, borderColor
149 */
180 */
181 /*!
182 \qmlsignal PieSlice::borderColorChanged()
183 This signal is emitted when slice border color changes.
184 \sa borderColor
185 */
150
186
151 /*!
187 /*!
152 \property QPieSlice::borderWidth
188 \property QPieSlice::borderWidth
153
154 Width of the slice border.
189 Width of the slice border.
155
156 This is a convenience property for modifying the slice pen.
190 This is a convenience property for modifying the slice pen.
157
158 \sa pen, borderColor
191 \sa pen, borderColor
159 */
192 */
193 /*!
194 \qmlproperty int PieSlice::borderWidth
195 Width of the slice border.
196 This is a convenience property for modifying the slice pen.
197 \sa borderColor
198 */
160
199
161 /*!
200 /*!
162 \fn void QPieSlice::borderWidthChanged()
201 \fn void QPieSlice::borderWidthChanged()
163
164 This signal is emitted when slice border width changes.
202 This signal is emitted when slice border width changes.
165
166 \sa pen, borderWidth
203 \sa pen, borderWidth
167 */
204 */
205 /*!
206 \qmlsignal PieSlice::borderWidthChanged()
207 This signal is emitted when slice border width changes.
208 \sa borderWidth
209 */
168
210
169 /*!
211 /*!
170 \property QPieSlice::brush
212 \property QPieSlice::brush
171
172 Brush used to draw the slice.
213 Brush used to draw the slice.
173 */
214 */
174
215
175 /*!
216 /*!
176 \fn void QPieSlice::brushChanged()
217 \fn void QPieSlice::brushChanged()
177
178 This signal is emitted when the brush of the slice has changed.
218 This signal is emitted when the brush of the slice has changed.
179
180 \sa brush
219 \sa brush
181 */
220 */
182
221
183 /*!
222 /*!
184 \property QPieSlice::color
223 \property QPieSlice::color
185
224 Fill (brush) color of the slice.
186 Color used to draw the slice.
187
188 This is a convenience property for modifying the slice brush.
225 This is a convenience property for modifying the slice brush.
189
190 \sa brush
226 \sa brush
191 */
227 */
228 /*!
229 \qmlproperty color PieSlice::color
230 Fill (brush) color of the slice.
231 */
192
232
193 /*!
233 /*!
194 \fn void QPieSlice::colorChanged()
234 \fn void QPieSlice::colorChanged()
195
196 This signal is emitted when slice color changes.
235 This signal is emitted when slice color changes.
197
198 \sa brush
236 \sa brush
199 */
237 */
238 /*!
239 \qmlsignal PieSlice::colorChanged()
240 This signal is emitted when slice color changes.
241 */
200
242
201 /*!
243 /*!
202 \property QPieSlice::labelBrush
244 \property QPieSlice::labelBrush
203
245 Brush used to draw label and label arm of the slice.
204 Pen used to draw label and label arm of the slice.
205
206 \sa label, labelVisible, labelFont, labelArmLengthFactor
246 \sa label, labelVisible, labelFont, labelArmLengthFactor
207 */
247 */
208
248
209 /*!
249 /*!
210 \fn void QPieSlice::labelBrushChanged()
250 \fn void QPieSlice::labelBrushChanged()
211
212 This signal is emitted when the label pen of the slice has changed.
251 This signal is emitted when the label pen of the slice has changed.
213
214 \sa labelBrush
252 \sa labelBrush
215 */
253 */
216
254
217 /*!
255 /*!
218 \property QPieSlice::labelColor
256 \property QPieSlice::labelColor
219
220 Color used to draw the slice label.
257 Color used to draw the slice label.
221
222 This is a convenience property for modifying the slice label brush.
258 This is a convenience property for modifying the slice label brush.
223
224 \sa labelBrush
259 \sa labelBrush
225 */
260 */
261 /*!
262 \qmlproperty color PieSlice::labelColor
263 Color used to draw the slice label.
264 */
226
265
227 /*!
266 /*!
228 \fn void QPieSlice::labelColorChanged()
267 \fn void QPieSlice::labelColorChanged()
229
230 This signal is emitted when slice label color changes.
268 This signal is emitted when slice label color changes.
231
269 \sa labelColor
270 */
271 /*!
272 \qmlsignal PieSlice::labelColorChanged()
273 This signal is emitted when slice label color changes.
232 \sa labelColor
274 \sa labelColor
233 */
275 */
234
276
235 /*!
277 /*!
236 \property QPieSlice::labelFont
278 \property QPieSlice::labelFont
237
238 Font used for drawing label text.
279 Font used for drawing label text.
239
240 \sa label, labelVisible, labelArmLengthFactor
280 \sa label, labelVisible, labelArmLengthFactor
241 */
281 */
242
282
243 /*!
283 /*!
244 \fn void QPieSlice::labelFontChanged()
284 \fn void QPieSlice::labelFontChanged()
245
246 This signal is emitted when the label font of the slice has changed.
285 This signal is emitted when the label font of the slice has changed.
247
248 \sa labelFont
286 \sa labelFont
249 */
287 */
250
288
251 /*!
289 /*!
252 \property QPieSlice::labelPosition
290 \property QPieSlice::labelPosition
253
254 Position of the slice label.
291 Position of the slice label.
255
256 \sa label, labelVisible
292 \sa label, labelVisible
257 */
293 */
294 /*!
295 \qmlproperty LabelPosition PieSlice::labelPosition
296 Position of the slice label. One of PieSlice.LabelOutside or PieSlice.LabelInside.
297 \sa labelVisible
298 */
258
299
259 /*!
300 /*!
260 \fn void QPieSlice::labelPositionChanged()
301 \fn void QPieSlice::labelPositionChanged()
261
262 This signal is emitted when the label position of the slice has changed.
302 This signal is emitted when the label position of the slice has changed.
263
303 \sa labelPosition
304 */
305 /*!
306 \qmlsignal PieSlice::labelPositionChanged()
307 This signal is emitted when the label position of the slice has changed.
264 \sa labelPosition
308 \sa labelPosition
265 */
309 */
266
310
267 /*!
311 /*!
268 \property QPieSlice::labelArmLengthFactor
312 \property QPieSlice::labelArmLengthFactor
269
270 Defines the length of the label arm.
313 Defines the length of the label arm.
271
272 The factor is relative to pie radius. For example:
314 The factor is relative to pie radius. For example:
273 1.0 means the length is the same as the radius.
315 1.0 means the length is the same as the radius.
274 0.5 means the length is half of the radius.
316 0.5 means the length is half of the radius.
275
317 By default the arm length is 0.15
276 Default value is 0.15
277
278 \sa label, labelVisible, labelBrush, labelFont
318 \sa label, labelVisible, labelBrush, labelFont
279 */
319 */
320 /*!
321 \qmlproperty real PieSlice::labelArmLengthFactor
322 Defines the length of the label arm.
323 The factor is relative to pie radius. For example:
324 1.0 means the length is the same as the radius.
325 0.5 means the length is half of the radius.
326 By default the arm length is 0.15
327 \sa labelVisible
328 */
280
329
281 /*!
330 /*!
282 \fn void QPieSlice::labelArmLengthFactorChanged()
331 \fn void QPieSlice::labelArmLengthFactorChanged()
283
284 This signal is emitted when the label arm factor of the slice has changed.
332 This signal is emitted when the label arm factor of the slice has changed.
285
333 \sa labelArmLengthFactor
334 */
335 /*!
336 \qmlsignal PieSlice::labelArmLengthFactorChanged()
337 This signal is emitted when the label arm factor of the slice has changed.
286 \sa labelArmLengthFactor
338 \sa labelArmLengthFactor
287 */
339 */
288
340
289 /*!
341 /*!
290 \property QPieSlice::explodeDistanceFactor
342 \property QPieSlice::explodeDistanceFactor
291
292 When the slice is exploded this factor defines how far the slice is exploded away from the pie.
343 When the slice is exploded this factor defines how far the slice is exploded away from the pie.
293
294 The factor is relative to pie radius. For example:
344 The factor is relative to pie radius. For example:
295 1.0 means the distance is the same as the radius.
345 1.0 means the distance is the same as the radius.
296 0.5 means the distance is half of the radius.
346 0.5 means the distance is half of the radius.
297
347 By default the distance is is 0.15
298 Default value is 0.15
348 \sa exploded
299
349 */
350 /*!
351 \qmlproperty real PieSlice::explodeDistanceFactor
352 When the slice is exploded this factor defines how far the slice is exploded away from the pie.
353 The factor is relative to pie radius. For example:
354 1.0 means the distance is the same as the radius.
355 0.5 means the distance is half of the radius.
356 By default the distance is is 0.15
300 \sa exploded
357 \sa exploded
301 */
358 */
302
359
303 /*!
360 /*!
304 \fn void QPieSlice::explodeDistanceFactorChanged()
361 \fn void QPieSlice::explodeDistanceFactorChanged()
305
306 This signal is emitted when the explode distance factor of the slice has changed.
362 This signal is emitted when the explode distance factor of the slice has changed.
307
363 \sa explodeDistanceFactor
364 */
365 /*!
366 \qmlsignal PieSlice::explodeDistanceFactorChanged()
367 This signal is emitted when the explode distance factor of the slice has changed.
308 \sa explodeDistanceFactor
368 \sa explodeDistanceFactor
309 */
369 */
310
370
311 /*!
371 /*!
312 \property QPieSlice::percentage
372 \property QPieSlice::percentage
313
314 Percentage of the slice compared to the sum of all slices in the series.
373 Percentage of the slice compared to the sum of all slices in the series.
315
316 The actual value ranges from 0.0 to 1.0.
374 The actual value ranges from 0.0 to 1.0.
317
318 Updated automatically once the slice is added to the series.
375 Updated automatically once the slice is added to the series.
319
320 \sa value, QPieSeries::sum
376 \sa value, QPieSeries::sum
321 */
377 */
378 /*!
379 \qmlproperty real PieSlice::percentage
380 Percentage of the slice compared to the sum of all slices in the series.
381 The actual value ranges from 0.0 to 1.0.
382 Updated automatically once the slice is added to the series.
383 */
322
384
323 /*!
385 /*!
324 \fn void QPieSlice::percentageChanged()
386 \fn void QPieSlice::percentageChanged()
325
326 This signal is emitted when the percentage of the slice has changed.
387 This signal is emitted when the percentage of the slice has changed.
327
388 \sa percentage
389 */
390 /*!
391 \qmlsignal void PieSlice::percentageChanged()
392 This signal is emitted when the percentage of the slice has changed.
328 \sa percentage
393 \sa percentage
329 */
394 */
330
395
331 /*!
396 /*!
332 \property QPieSlice::startAngle
397 \property QPieSlice::startAngle
333
334 Defines the starting angle of this slice in the series it belongs to.
398 Defines the starting angle of this slice in the series it belongs to.
335
336 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
399 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
337
400 Updated automatically once the slice is added to the series.
401 */
402 /*!
403 \qmlproperty real PieSlice::startAngle
404 Defines the starting angle of this slice in the series it belongs to.
405 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
338 Updated automatically once the slice is added to the series.
406 Updated automatically once the slice is added to the series.
339 */
407 */
340
408
341 /*!
409 /*!
342 \fn void QPieSlice::startAngleChanged()
410 \fn void QPieSlice::startAngleChanged()
343
344 This signal is emitted when the starting angle f the slice has changed.
411 This signal is emitted when the starting angle f the slice has changed.
345
412 \sa startAngle
413 */
414 /*!
415 \qmlsignal PieSlice::startAngleChanged()
416 This signal is emitted when the starting angle f the slice has changed.
346 \sa startAngle
417 \sa startAngle
347 */
418 */
348
419
349 /*!
420 /*!
350 \property QPieSlice::angleSpan
421 \property QPieSlice::angleSpan
351
352 Span of the slice in degrees.
422 Span of the slice in degrees.
353
354 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
423 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
355
424 Updated automatically once the slice is added to the series.
425 */
426 /*!
427 \qmlproperty real PieSlice::angleSpan
428 Span of the slice in degrees.
429 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
356 Updated automatically once the slice is added to the series.
430 Updated automatically once the slice is added to the series.
357 */
431 */
358
432
359 /*!
433 /*!
360 \fn void QPieSlice::angleSpanChanged()
434 \fn void QPieSlice::angleSpanChanged()
361
362 This signal is emitted when the angle span of the slice has changed.
435 This signal is emitted when the angle span of the slice has changed.
363
364 \sa angleSpan
436 \sa angleSpan
365 */
437 */
366
438 /*!
439 \qmlsignal PieSlice::angleSpanChanged()
440 This signal is emitted when the angle span of the slice has changed.
441 \sa angleSpan
442 */
367
443
368 /*!
444 /*!
369 \fn void QPieSlice::clicked()
445 \fn void QPieSlice::clicked()
370
371 This signal is emitted when user has clicked the slice.
446 This signal is emitted when user has clicked the slice.
372
373 \sa QPieSeries::clicked()
447 \sa QPieSeries::clicked()
374 */
448 */
449 /*!
450 \qmlsignal PieSlice::onClicked()
451 This signal is emitted when user has clicked the slice.
452 */
375
453
376 /*!
454 /*!
377 \fn void QPieSlice::hovered(bool state)
455 \fn void QPieSlice::hovered(bool state)
378
379 This signal is emitted when user has hovered over or away from the slice.
456 This signal is emitted when user has hovered over or away from the slice.
380
381 \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
457 \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
382
383 \sa QPieSeries::hovered()
458 \sa QPieSeries::hovered()
384 */
459 */
460 /*!
461 \qmlsignal PieSlice::onHovered(bool state)
462 This signal is emitted when user has hovered over or away from the slice.
463 \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
464 */
385
465
386 /*!
466 /*!
387 Constructs an empty slice with a \a parent.
467 Constructs an empty slice with a \a parent.
388
389 \sa QPieSeries::append(), QPieSeries::insert()
468 \sa QPieSeries::append(), QPieSeries::insert()
390 */
469 */
391 QPieSlice::QPieSlice(QObject *parent)
470 QPieSlice::QPieSlice(QObject *parent)
@@ -65,6 +65,8 Flow {
65 onPercentageChanged: console.log("slice.onPercentageChanged: " + series.at(0).percentage);
65 onPercentageChanged: console.log("slice.onPercentageChanged: " + series.at(0).percentage);
66 onStartAngleChanged: console.log("slice.onStartAngleChanged: " + series.at(0).startAngle);
66 onStartAngleChanged: console.log("slice.onStartAngleChanged: " + series.at(0).startAngle);
67 onAngleSpanChanged: console.log("slice.onAngleSpanChanged: " + series.at(0).angleSpan);
67 onAngleSpanChanged: console.log("slice.onAngleSpanChanged: " + series.at(0).angleSpan);
68 onClicked: console.log("slice.onClicked");
69 onHovered: console.log("slice.onHovered: " + state);
68 }
70 }
69
71
70 Button {
72 Button {
General Comments 0
You need to be logged in to leave comments. Login now