##// END OF EJS Templates
QML PieSlice documentation
Tero Ahola -
r1470:048f828e9404
parent child
Show More
@@ -6,6 +6,8
6 6 QtCommercial Charts QML API is an intuitive and simple way to show charts in your QML
7 7 applications. The following example QML shows you how to create a simple pie chart:
8 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 12 \beginfloatleft
11 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 58 \enum QPieSlice::LabelPosition
43 59
44 60 This enum describes the position of the slice label.
@@ -50,342 +66,405 QTCOMMERCIALCHART_BEGIN_NAMESPACE
50 66
51 67 /*!
52 68 \property QPieSlice::label
53
54 69 Label of the slice.
55
56 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 78 \fn void QPieSlice::labelChanged()
61
62 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 85 \sa label
65 86 */
66 87
67 88 /*!
68 89 \property QPieSlice::value
69
70 90 Value of the slice.
71
72 91 Note that if users sets a negative value it is converted to a positive value.
73
74 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 100 \fn void QPieSlice::valueChanged()
79
80 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 107 \sa value
83 108 */
84 109
85 110 /*!
86 111 \property QPieSlice::labelVisible
87
88 Defienes the visibility of the slice label.
89
90 Default is not visible.
91
112 Defines the visibility of slice label. By default the label is not visible.
92 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 121 \fn void QPieSlice::labelVisibleChanged()
97
98 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 128 \sa labelVisible
101 129 */
102 130
103 131 /*!
104 132 \property QPieSlice::exploded
105
106 Defines if the slice is exploded from the pie.
107
133 If set to true the slice is "exploded" away from the pie.
134 \sa explodeDistanceFactor
135 */
136 /*!
137 \qmlproperty bool PieSlice::exploded
138 If set to true the slice is "exploded" away from the pie.
108 139 \sa explodeDistanceFactor
109 140 */
110 141
111 142 /*!
112 143 \fn void QPieSlice::explodedChanged()
113
114 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 150 \sa exploded
117 151 */
118 152
119 153 /*!
120 154 \property QPieSlice::pen
121
122 155 Pen used to draw the slice border.
123 156 */
124 157
125 158 /*!
126 159 \fn void QPieSlice::penChanged()
127
128 160 This signal is emitted when the pen of the slice has changed.
129
130 161 \sa pen
131 162 */
132 163
133 164 /*!
134 165 \property QPieSlice::borderColor
135
136 166 Color used to draw the slice border.
137
138 167 This is a convenience property for modifying the slice pen.
139
140 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 177 \fn void QPieSlice::borderColorChanged()
145
146 178 This signal is emitted when slice border color changes.
147
148 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 188 \property QPieSlice::borderWidth
153
154 189 Width of the slice border.
155
156 190 This is a convenience property for modifying the slice pen.
157
158 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 201 \fn void QPieSlice::borderWidthChanged()
163
164 202 This signal is emitted when slice border width changes.
165
166 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 212 \property QPieSlice::brush
171
172 213 Brush used to draw the slice.
173 214 */
174 215
175 216 /*!
176 217 \fn void QPieSlice::brushChanged()
177
178 218 This signal is emitted when the brush of the slice has changed.
179
180 219 \sa brush
181 220 */
182 221
183 222 /*!
184 223 \property QPieSlice::color
185
186 Color used to draw the slice.
187
224 Fill (brush) color of the slice.
188 225 This is a convenience property for modifying the slice brush.
189
190 226 \sa brush
191 227 */
228 /*!
229 \qmlproperty color PieSlice::color
230 Fill (brush) color of the slice.
231 */
192 232
193 233 /*!
194 234 \fn void QPieSlice::colorChanged()
195
196 235 This signal is emitted when slice color changes.
197
198 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 244 \property QPieSlice::labelBrush
203
204 Pen used to draw label and label arm of the slice.
205
245 Brush used to draw label and label arm of the slice.
206 246 \sa label, labelVisible, labelFont, labelArmLengthFactor
207 247 */
208 248
209 249 /*!
210 250 \fn void QPieSlice::labelBrushChanged()
211
212 251 This signal is emitted when the label pen of the slice has changed.
213
214 252 \sa labelBrush
215 253 */
216 254
217 255 /*!
218 256 \property QPieSlice::labelColor
219
220 257 Color used to draw the slice label.
221
222 258 This is a convenience property for modifying the slice label brush.
223
224 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 267 \fn void QPieSlice::labelColorChanged()
229
230 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 274 \sa labelColor
233 275 */
234 276
235 277 /*!
236 278 \property QPieSlice::labelFont
237
238 279 Font used for drawing label text.
239
240 280 \sa label, labelVisible, labelArmLengthFactor
241 281 */
242 282
243 283 /*!
244 284 \fn void QPieSlice::labelFontChanged()
245
246 285 This signal is emitted when the label font of the slice has changed.
247
248 286 \sa labelFont
249 287 */
250 288
251 289 /*!
252 290 \property QPieSlice::labelPosition
253
254 291 Position of the slice label.
255
256 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 301 \fn void QPieSlice::labelPositionChanged()
261
262 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 308 \sa labelPosition
265 309 */
266 310
267 311 /*!
268 312 \property QPieSlice::labelArmLengthFactor
269
270 313 Defines the length of the label arm.
271
272 314 The factor is relative to pie radius. For example:
273 315 1.0 means the length is the same as the radius.
274 316 0.5 means the length is half of the radius.
275
276 Default value is 0.15
277
317 By default the arm length is 0.15
278 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 331 \fn void QPieSlice::labelArmLengthFactorChanged()
283
284 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 338 \sa labelArmLengthFactor
287 339 */
288 340
289 341 /*!
290 342 \property QPieSlice::explodeDistanceFactor
291
292 343 When the slice is exploded this factor defines how far the slice is exploded away from the pie.
293
294 344 The factor is relative to pie radius. For example:
295 345 1.0 means the distance is the same as the radius.
296 346 0.5 means the distance is half of the radius.
297
298 Default value is 0.15
299
347 By default the distance is is 0.15
348 \sa exploded
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 357 \sa exploded
301 358 */
302 359
303 360 /*!
304 361 \fn void QPieSlice::explodeDistanceFactorChanged()
305
306 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 368 \sa explodeDistanceFactor
309 369 */
310 370
311 371 /*!
312 372 \property QPieSlice::percentage
313
314 373 Percentage of the slice compared to the sum of all slices in the series.
315
316 374 The actual value ranges from 0.0 to 1.0.
317
318 375 Updated automatically once the slice is added to the series.
319
320 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 386 \fn void QPieSlice::percentageChanged()
325
326 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 393 \sa percentage
329 394 */
330 395
331 396 /*!
332 397 \property QPieSlice::startAngle
333
334 398 Defines the starting angle of this slice in the series it belongs to.
335
336 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 406 Updated automatically once the slice is added to the series.
339 407 */
340 408
341 409 /*!
342 410 \fn void QPieSlice::startAngleChanged()
343
344 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 417 \sa startAngle
347 418 */
348 419
349 420 /*!
350 421 \property QPieSlice::angleSpan
351
352 422 Span of the slice in degrees.
353
354 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 430 Updated automatically once the slice is added to the series.
357 431 */
358 432
359 433 /*!
360 434 \fn void QPieSlice::angleSpanChanged()
361
362 435 This signal is emitted when the angle span of the slice has changed.
363
364 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 445 \fn void QPieSlice::clicked()
370
371 446 This signal is emitted when user has clicked the slice.
372
373 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 455 \fn void QPieSlice::hovered(bool state)
378
379 456 This signal is emitted when user has hovered over or away from the slice.
380
381 457 \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
382
383 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 467 Constructs an empty slice with a \a parent.
388
389 468 \sa QPieSeries::append(), QPieSeries::insert()
390 469 */
391 470 QPieSlice::QPieSlice(QObject *parent)
@@ -65,6 +65,8 Flow {
65 65 onPercentageChanged: console.log("slice.onPercentageChanged: " + series.at(0).percentage);
66 66 onStartAngleChanged: console.log("slice.onStartAngleChanged: " + series.at(0).startAngle);
67 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 72 Button {
General Comments 0
You need to be logged in to leave comments. Login now