- class QPieSeries#
The
QPieSeries
class presents data in pie charts. More…Synopsis#
Properties#
countᅟ
- Number of slices in the seriesendAngleᅟ
- Ending angle of the pieholeSizeᅟ
- Donut hole sizehorizontalPositionᅟ
- Horizontal position of the piesizeᅟ
- Pie sizestartAngleᅟ
- Starting angle of the piesumᅟ
- Of all slicesverticalPositionᅟ
- Vertical position of the pie
Methods#
def
__init__()
def
append()
def
clear()
def
count()
def
holeSize()
def
insert()
def
isEmpty()
def
__lshift__()
def
pieEndAngle()
def
pieSize()
def
pieStartAngle()
def
remove()
def
setHoleSize()
def
setPieEndAngle()
def
setPieSize()
def
slices()
def
sum()
def
take()
Signals#
def
added()
def
clicked()
def
countChanged()
def
doubleClicked()
def
hovered()
def
pressed()
def
released()
def
removed()
def
sumChanged()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
A pie series consists of slices that are defined as
QPieSlice
objects. The slices can have any values as theQPieSeries
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 Charts with Widgets Gallery to learn how to use
QPieSeries
.Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property countᅟ: int#
This property holds The number of slices in the series..
- Access functions:
Signal
countChanged()
- property endAngleᅟ: float#
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:
- property holeSizeᅟ: float#
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:
- property horizontalPositionᅟ: float#
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).
See also
- Access functions:
- property sizeᅟ: float#
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:
- property startAngleᅟ: float#
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:
- property sumᅟ: float#
This property holds The sum of all slices..
The series keeps track of the sum of all the slices it holds.
- Access functions:
Signal
sumChanged()
- property verticalPositionᅟ: float#
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).
See also
- Access functions:
Constructs a series object that is a child of
parent
.- added(slices)#
- Parameters:
slices – .list of QPieSlice
This signal is emitted when the slices specified by
slices
are added to the series.- append(slices)#
- Parameters:
slices – .list of QPieSlice
- Return type:
bool
Appends the array of slices specified by
slices
to the series. Slice ownership is passed to the series.Returns
true
if appending succeeds.- append(label, value)
- Parameters:
label – str
value – float
- Return type:
Appends a single slice with the specified
value
andlabel
to the series. Slice ownership is passed to the series. Returns null ifvalue
isNaN
,Inf
, or-Inf
and adds nothing to the series.- append(slice)
- Parameters:
slice –
QPieSlice
- Return type:
bool
Appends the slice specified by
slice
to the series. Slice ownership is passed to the series.Returns
true
if appending succeeds.- clear()#
Clears all slices from the series.
This signal is emitted when the slice specified by
slice
is clicked.See also
- count()#
- Return type:
int
Returns the number of the slices in this series.
Getter of property
countᅟ
.- countChanged()#
This signal is emitted when the slice count changes.
See also
Notification signal of property
countᅟ
.This signal is emitted when the slice specified by
slice
is double-clicked.See also
- holeSize()#
- Return type:
float
See also
Getter of property
holeSizeᅟ
.- horizontalPosition()#
- Return type:
float
See also
Getter of property
horizontalPositionᅟ
.This signal is emitted when a mouse is hovered over the slice specified by
slice
. When the mouse moves over the slice,state
turnstrue
, and when the mouse moves away again, it turnsfalse
.See also
Inserts the slice specified by
slice
to the series before the slice at the position specified byindex
. Slice ownership is passed to the series.Returns
true
if inserting succeeds.- isEmpty()#
- Return type:
bool
Returns
true
if the series is empty.Appends the slice specified by
slice
to the series and returns a reference to the series. Slice ownership is passed to the series.- pieEndAngle()#
- Return type:
float
Returns the end angle of the pie.
A full pie is 360 degrees, where 0 degrees is at 12 a’clock.
Getter of property
endAngleᅟ
.- pieSize()#
- Return type:
float
See also
Getter of property
sizeᅟ
.- pieStartAngle()#
- Return type:
float
See also
Getter of property
startAngleᅟ
.This signal is emitted when the user clicks the slice specified by
slice
and holds down the mouse button.See also
This signal is emitted when the user releases the mouse press on the slice specified by
slice
.See also
Removes a single slice, specified by
slice
, from the series and deletes it permanently.The pointer cannot be referenced after this call.
Returns
true
if the removal succeeds.- removed(slices)#
- Parameters:
slices – .list of QPieSlice
This signal is emitted when the slices specified by
slices
are removed from the series.See also
- setHoleSize(holeSize)#
- Parameters:
holeSize – float
See also
Setter of property
holeSizeᅟ
.- setHorizontalPosition(relativePosition)#
- Parameters:
relativePosition – float
See also
Setter of property
horizontalPositionᅟ
.- setLabelsPosition(position)#
- Parameters:
position –
LabelPosition
Sets the position of all the slice labels to
position
.Note
This function affects only the current slices in the series. If a new slice is added, the default label position is
LabelOutside
.See also
- setLabelsVisible([visible=true])#
- Parameters:
visible – bool
Sets the visibility of all slice labels to
visible
.Note
This function affects only the current slices in the series. If a new slice is added, the default label visibility is
false
.See also
- setPieEndAngle(endAngle)#
- Parameters:
endAngle – float
Sets the end angle of the pie.
A full pie is 360 degrees, where 0 degrees is at 12 a’clock.
angle
must be greater than the start angle.Setter of property
endAngleᅟ
.Setter of property
sizeᅟ
.- setPieStartAngle(startAngle)#
- Parameters:
startAngle – float
See also
Setter of property
startAngleᅟ
.- setVerticalPosition(relativePosition)#
- Parameters:
relativePosition – float
See also
Setter of property
verticalPositionᅟ
.Returns a list of slices that belong to this series.
- sum()#
- Return type:
float
Returns the sum of all slice values in this series.
See also
Getter of property
sumᅟ
.- sumChanged()#
This signal is emitted when the sum of all slices changes.
See also
Notification signal of property
sumᅟ
.Takes a single slice, specified by
slice
, from the series. Does not delete the slice object.Note
The series remains the slice’s parent object. You must set the parent object to take full ownership.
Returns
true
if the take operation was successful.- verticalPosition()#
- Return type:
float
See also
Getter of property
verticalPositionᅟ
.