PySide6.QtGraphs.QPieSeries

class QPieSeries

The QPieSeries class presents data in pie graphs. More

Inheritance diagram of PySide6.QtGraphs.QPieSeries

Added in version 6.8.

Synopsis

Properties

Methods

Slots

Signals

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 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 graph.

Pie size and position on the graph are controlled by using relative values that range from 0.0 to 1.0. These relate to the actual graph 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 also

QPieSlice

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:
property endAngleᅟ: float

This property holds The ending angle of the pie..

A full pie is 360 degrees, where 0 degrees is at 12 o’clock.

The default value is 360.

Access functions:
property holeSizeᅟ: float

This property holds The donut hole size..

When setting the pieSize property, this 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 graph rectangle, so that:

  • 0.0 is the absolute left.

  • 1.0 is the absolute right.

The default value is 0.5 (center).

See also

verticalPosition

Access functions:
property pieSizeᅟ: float

This property holds The pie size..

The value is relative to the graph rectangle, so that:

  • 0.0 is the minimum pieSize (pie not drawn).

  • 1.0 is the maximum pieSize that can fit the graph.

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 o’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:
property verticalPositionᅟ: float

This property holds The vertical position of the pie..

The value is relative to the graph rectangle, so that:

  • 0.0 is the absolute top.

  • 1.0 is the absolute bottom.

The default value is 0.5 (center).

Access functions:
__init__([parent=None])
Parameters:

parentQObject

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.

See also

append()

append(slice)
Parameters:

sliceQPieSlice

Return type:

bool

Appends the slice specified by slice to the series. Slice ownership is passed to the series.

Returns true if appending succeeds.

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:

QPieSlice

Appends a single slice with the specified value and label to the series. Slice ownership is passed to the series. Returns null if value is NaN, Inf, or -Inf and adds nothing to the series.

at(index)
Parameters:

index – int

Return type:

QPieSlice

Returns the PieSlice at the position index. Returns null if no PieSlice was found.

clear()

Clears all slices from the series.

clicked(slice)
Parameters:

sliceQPieSlice

count()
Return type:

int

Returns the number of the slices in this series.

Getter of property countᅟ .

countChanged()

Notification signal of property countᅟ .

doubleClicked(slice)
Parameters:

sliceQPieSlice

endAngle()
Return type:

float

Returns the end angle of the pie.

A full pie is 360 degrees, where 0 degrees is at 12 o’clock.

Getter of property endAngleᅟ .

endAngleChanged()

Notification signal of property endAngleᅟ .

find(label)
Parameters:

label – str

Return type:

QPieSlice

Searches for a PieSlice which contains the label label. Returns the PieSlice if found, null otherwise.

handleSliceChange()
holeSize()
Return type:

float

See also

setHoleSize()

Getter of property holeSizeᅟ .

holeSizeChanged()

Notification signal of property holeSizeᅟ .

horizontalPosition()
Return type:

float

Getter of property horizontalPositionᅟ .

horizontalPositionChanged()

Notification signal of property horizontalPositionᅟ .

insert(index, slice)
Parameters:
Return type:

bool

Inserts the slice specified by slice to the series before the slice at the position specified by index. Slice ownership is passed to the series.

Returns true if inserting succeeds.

isEmpty()
Return type:

bool

Returns true if the series is empty.

__lshift__(slice)
Parameters:

sliceQPieSlice

Return type:

QPieSeries

Appends the slice specified by slice to the series and returns a reference to the series. Slice ownership is passed to the series.

pieSize()
Return type:

float

See also

setPieSize()

Getter of property pieSizeᅟ .

pieSizeChanged()

Notification signal of property pieSizeᅟ .

pressed(slice)
Parameters:

sliceQPieSlice

released(slice)
Parameters:

sliceQPieSlice

remove(slice)
Parameters:

sliceQPieSlice

Return type:

bool

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.

remove(index)
Parameters:

index – int

Return type:

bool

Removes the PieSlice at the location index. The PieSlice will be permanently deleted. Returns true if removing is successful.

removeMultiple(index, count)
Parameters:
  • index – int

  • count – int

Removes multiple PieSlices from the series starting from index to a number of count. The PieSlices will be permanently deleted.

removed(slices)
Parameters:

slices – .list of QPieSlice

This signal is emitted when the slices specified by slices are removed from the series.

See also

remove()

replace(slices)
Parameters:

slices – .list of QPieSlice

Return type:

bool

Replaces the entire list of PieSlices in the series with the list specified by slices. All the original PieSlices will be permanently deleted. Returns true if all PieSlices are replaced successfully.

replace(oldSlice, newSlice)
Parameters:
Return type:

bool

Replaces the PieSlice oldSlice with newSlice if found in the series.``oldSlice`` will be permanently deleted. Returns true if replacing is successful.

replace(index, slice)
Parameters:
Return type:

bool

Replaces the PieSlice at position index with the one specified by slice. The original PieSlice will be permanently deleted. Returns false if replacing any of the PieSlices fails.

replaced(slices)
Parameters:

slices – .list of QPieSlice

setEndAngle(endAngle)
Parameters:

endAngle – float

Sets the end angle of the pie.

A full pie is 360 degrees, where 0 degrees is at 12 o’clock.

angle must be greater than the start angle.

Setter of property endAngleᅟ .

setHoleSize(holeSize)
Parameters:

holeSize – float

See also

holeSize()

Setter of property holeSizeᅟ .

setHorizontalPosition(relativePosition)
Parameters:

relativePosition – float

Setter of property horizontalPositionᅟ .

setLabelsPosition(position)
Parameters:

positionLabelPosition

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 QPieSlice::LabelOutside.

setLabelsVisible(visible)
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.

setPieSize(relativeSize)
Parameters:

relativeSize – float

See also

pieSize()

Setter of property pieSizeᅟ .

setStartAngle(startAngle)
Parameters:

startAngle – float

Sets the start angle of the pie.

A full pie is 360 degrees, where 0 degrees is at 12 o’clock.

angle must be smaller than the end angle.

Setter of property startAngleᅟ .

setVerticalPosition(relativePosition)
Parameters:

relativePosition – float

Setter of property verticalPositionᅟ .

slices()
Return type:

.list of QPieSlice

Returns a list of slices that belong to this series.

startAngle()
Return type:

float

Returns the start angle of the pie.

A full pie is 360 degrees, where 0 degrees is at 12 o’clock.

Getter of property startAngleᅟ .

startAngleChanged()

Notification signal of property startAngleᅟ .

sum()
Return type:

float

Returns the sum of all slice values in this series.

Getter of property sumᅟ .

sumChanged()

Notification signal of property sumᅟ .

take(slice)
Parameters:

sliceQPieSlice

Return type:

bool

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

Getter of property verticalPositionᅟ .

verticalPositionChanged()

Notification signal of property verticalPositionᅟ .