QPieSeries Class
The QPieSeries class presents data in pie charts. More...
| Header: | #include <QPieSeries> |
| Instantiated By: | PieSeries |
| Inherits: | QAbstractSeries |
Properties
|
|
Public Functions
| int | count() const |
| qreal | holeSize() const |
| qreal | horizontalPosition() const |
| qreal | pieEndAngle() const |
| qreal | pieSize() const |
| qreal | pieStartAngle() const |
| void | setHoleSize(qreal holeSize) |
| void | setHorizontalPosition(qreal relativePosition) |
| void | setPieEndAngle(qreal endAngle) |
| void | setPieSize(qreal relativeSize) |
| void | setPieStartAngle(qreal startAngle) |
| void | setVerticalPosition(qreal relativePosition) |
| qreal | sum() const |
| qreal | verticalPosition() const |
Signals
| void | countChanged() |
| void | sumChanged() |
Detailed Description
A pie series consists of slices that are defined as QPieSlice objects. The slices can have any values as the QPieSeries object calculates the percentage of a slice compared with the sum of all slices in the series to determine the actual size of the slice in the chart.
Pie size and position on the chart are controlled by using relative values that range from 0.0 to 1.0. These relate to the actual chart rectangle.
By default, the pie is defined as a full pie. A partial pie can be created by setting a starting angle and angle span for the series. A full pie is 360 degrees, where 0 is at 12 a'clock.
See the pie chart example or donut chart example to learn how to use QPieSeries.


See also QPieSlice and QChart.
Property Documentation
count : const int
This property holds the number of slices in the series.
Access functions:
| int | count() const |
Notifier signal:
| void | countChanged() |
endAngle : qreal
This property holds the ending angle of the pie.
A full pie is 360 degrees, where 0 degrees is at 12 a'clock.
The default value is 360.
Access functions:
| qreal | pieEndAngle() const |
| void | setPieEndAngle(qreal endAngle) |
holeSize : qreal
This property holds the donut hole size.
The value is relative to the chart rectangle, so that:
- 0.0 is the minimum size (full pie drawn without a hole).
- 1.0 is the maximum size that can fit the chart (the donut has no width).
When setting this property, the size property is adjusted if necessary, to ensure that the hole size is not greater than the pie size.
The default value is 0.0.
Access functions:
| qreal | holeSize() const |
| void | setHoleSize(qreal holeSize) |
horizontalPosition : qreal
This property holds the horizontal position of the pie.
The value is relative to the chart rectangle, so that:
- 0.0 is the absolute left.
- 1.0 is the absolute right.
The default value is 0.5 (center).
Access functions:
| qreal | horizontalPosition() const |
| void | setHorizontalPosition(qreal relativePosition) |
See also verticalPosition.
size : qreal
This property holds the pie size.
The value is relative to the chart rectangle, so that:
- 0.0 is the minimum size (pie not drawn).
- 1.0 is the maximum size that can fit the chart.
When setting this property, the holeSize property is adjusted if necessary, to ensure that the hole size is not greater than the pie size.
The default value is 0.7.
Access functions:
| qreal | pieSize() const |
| void | setPieSize(qreal relativeSize) |
startAngle : qreal
This property holds the starting angle of the pie.
A full pie is 360 degrees, where 0 degrees is at 12 a'clock.
The default value is 0.
Access functions:
| qreal | pieStartAngle() const |
| void | setPieStartAngle(qreal startAngle) |
sum : const qreal
This property holds the sum of all slices.
The series keeps track of the sum of all the slices it holds.
Access functions:
| qreal | sum() const |
Notifier signal:
| void | sumChanged() |
verticalPosition : qreal
This property holds the vertical position of the pie.
The value is relative to the chart rectangle, so that:
- 0.0 is the absolute top.
- 1.0 is the absolute bottom.
The default value is 0.5 (center).
Access functions:
| qreal | verticalPosition() const |
| void | setVerticalPosition(qreal relativePosition) |
See also horizontalPosition.