QPieSlice#
The QPieSlice
class represents a single slice in a pie series. More…
Synopsis#
Properties#
angleSpan
- Span of the slice in degrees. A full pie is 360 degrees, where 0 degrees is at 12 a’clock. Updated automatically once the slice is added to the seriesborderColor
- Color used to draw the slice border. This is a convenience property for modifying the slice penborderWidth
- Width of the slice border. This is a convenience property for modifying the slice penbrush
- Used to fill the slicecolor
- Fill (brush) color of the slice. This is a convenience property for modifying the slice brushexplodeDistanceFactor
- Determines how far away from the pie the slice is explodedexploded
- Whether the slice is separated from the pielabel
- Of the slicelabelArmLengthFactor
- Length of the label arm. The factor is relative to the pie radius. For example:labelBrush
- Brush used to draw the label and label arm of the slicelabelColor
- Color used to draw the slice label. This is a convenience property for modifying the slice label brushlabelFont
- Font used for drawing the label textlabelPosition
- Position of the slice labellabelVisible
- Visibility of the slice label. By default, the label is not visiblepen
- Used to draw the slice borderpercentage
- Of the slice compared to the sum of all slices in the series. The actual value ranges from 0.0 to 1.0. Updated automatically once the slice is added to the seriesstartAngle
- Starting angle of this slice in the series it belongs to. A full pie is 360 degrees, where 0 degrees is at 12 a’clock. Updated automatically once the slice is added to the seriesvalue
- Of the slice
Functions#
def
angleSpan
()def
borderColor
()def
borderWidth
()def
brush
()def
color
()def
explodeDistanceFactor
()def
isExploded
()def
isLabelVisible
()def
label
()def
labelArmLengthFactor
()def
labelBrush
()def
labelColor
()def
labelFont
()def
labelPosition
()def
pen
()def
percentage
()def
series
()def
setBorderColor
(color)def
setBorderWidth
(width)def
setBrush
(brush)def
setColor
(color)def
setExplodeDistanceFactor
(factor)def
setExploded
([exploded=true])def
setLabel
(label)def
setLabelArmLengthFactor
(factor)def
setLabelBrush
(brush)def
setLabelColor
(color)def
setLabelFont
(font)def
setLabelPosition
(position)def
setLabelVisible
([visible=true])def
setPen
(pen)def
setValue
(value)def
startAngle
()def
value
()
Signals#
def
angleSpanChanged
()def
borderColorChanged
()def
borderWidthChanged
()def
brushChanged
()def
clicked
()def
colorChanged
()def
doubleClicked
()def
hovered
(state)def
labelBrushChanged
()def
labelChanged
()def
labelColorChanged
()def
labelFontChanged
()def
labelVisibleChanged
()def
penChanged
()def
percentageChanged
()def
pressed
()def
released
()def
startAngleChanged
()def
valueChanged
()
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 slice has a value and a label. When the slice is added to a pie series, the QPieSeries
object calculates the percentage of the slice compared with the sum of all slices in the series to determine the actual size of the slice in the chart.
By default, the label is hidden. If it is visible, it can be either located outside the slice and connected to it with an arm or centered inside the slice either horizontally or in parallel with the tangential or normal of the slice’s arc.
By default, the visual appearance of the slice is set by a theme, but the theme can be overridden by specifying slice properties. However, if the theme is changed after the slices are customized, all customization will be lost.
To enable user interaction with the pie chart, some basic signals are emitted when users click pie slices or hover the mouse over them.
See also
- class PySide6.QtCharts.QPieSlice([parent=None])#
PySide6.QtCharts.QPieSlice(label, value[, parent=None])
- Parameters:
label – str
value – float
parent –
PySide6.QtCore.QObject
Constructs an empty slice with the parent parent
.
Constructs an empty slice with the specified value
, label
, and parent
.
Note
Properties can be used directly when from __feature__ import true_property
is used or via accessor functions otherwise.
- property PᅟySide6.QtCharts.QPieSlice.angleSpan: float#
This property holds The span of the slice in degrees. A full pie is 360 degrees, where 0 degrees is at 12 a’clock. Updated automatically once the slice is added to the series..
- Access functions:
angleSpan
()Signal
angleSpanChanged
()
- property PᅟySide6.QtCharts.QPieSlice.borderColor: PySide6.QtGui.QColor#
This property holds The color used to draw the slice border. This is a convenience property for modifying the slice pen..
See also
- Access functions:
borderColor
()setBorderColor
(color)Signal
borderColorChanged
()
- property PᅟySide6.QtCharts.QPieSlice.borderWidth: int#
This property holds The width of the slice border. This is a convenience property for modifying the slice pen..
See also
- Access functions:
borderWidth
()setBorderWidth
(width)Signal
borderWidthChanged
()
- property PᅟySide6.QtCharts.QPieSlice.brush: PySide6.QtGui.QBrush#
This property holds The brush used to fill the slice..
- Access functions:
brush
()setBrush
(brush)Signal
brushChanged
()
- property PᅟySide6.QtCharts.QPieSlice.color: PySide6.QtGui.QColor#
This property holds The fill (brush) color of the slice. This is a convenience property for modifying the slice brush..
See also
- Access functions:
color
()setColor
(color)Signal
colorChanged
()
- property PᅟySide6.QtCharts.QPieSlice.explodeDistanceFactor: float#
This property Determines how far away from the pie the slice is exploded..
1.0 means that the distance is the same as the radius.
0.5 means that the distance is half of the radius.
By default, the distance is 0.15
See also
exploded
- Access functions:
setExplodeDistanceFactor
(factor)
- property PᅟySide6.QtCharts.QPieSlice.exploded: bool#
This property holds Whether the slice is separated from the pie..
See also
- Access functions:
isExploded
()setExploded
([exploded=true])
- property PᅟySide6.QtCharts.QPieSlice.label: str#
This property holds The label of the slice..
Note
The string can be HTML formatted.
See also
labelVisible
labelBrush
labelFont
labelArmLengthFactor
- Access functions:
label
()setLabel
(label)Signal
labelChanged
()
- property PᅟySide6.QtCharts.QPieSlice.labelArmLengthFactor: float#
This property holds The length of the label arm. The factor is relative to the pie radius. For example:.
1.0 means that the length is the same as the radius.
0.5 means that the length is half of the radius.
By default, the arm length is 0.15
See also
label
labelVisible
labelBrush
labelFont
- Access functions:
setLabelArmLengthFactor
(factor)
- property PᅟySide6.QtCharts.QPieSlice.labelBrush: PySide6.QtGui.QBrush#
This property holds The brush used to draw the label and label arm of the slice..
See also
label
labelVisible
labelFont
labelArmLengthFactor
- Access functions:
labelBrush
()setLabelBrush
(brush)Signal
labelBrushChanged
()
- property PᅟySide6.QtCharts.QPieSlice.labelColor: PySide6.QtGui.QColor#
This property holds The color used to draw the slice label. This is a convenience property for modifying the slice label brush..
See also
- Access functions:
labelColor
()setLabelColor
(color)Signal
labelColorChanged
()
- property PᅟySide6.QtCharts.QPieSlice.labelFont: PySide6.QtGui.QFont#
This property holds The font used for drawing the label text..
See also
label
labelVisible
labelArmLengthFactor
- Access functions:
labelFont
()setLabelFont
(font)Signal
labelFontChanged
()
- property PᅟySide6.QtCharts.QPieSlice.labelPosition: LabelPosition#
This property holds The position of the slice label..
See also
label
labelVisible
- Access functions:
setLabelPosition
(position)
- property PᅟySide6.QtCharts.QPieSlice.labelVisible: bool#
This property holds The visibility of the slice label. By default, the label is not visible..
See also
- Access functions:
setLabelVisible
([visible=true])Signal
labelVisibleChanged
()
- property PᅟySide6.QtCharts.QPieSlice.pen: PySide6.QtGui.QPen#
This property holds The pen used to draw the slice border..
- Access functions:
pen
()setPen
(pen)Signal
penChanged
()
- property PᅟySide6.QtCharts.QPieSlice.percentage: float#
This property holds The percentage of the slice compared to the sum of all slices in the series. The actual value ranges from 0.0 to 1.0. Updated automatically once the slice is added to the series..
- Access functions:
percentage
()Signal
percentageChanged
()
- property PᅟySide6.QtCharts.QPieSlice.startAngle: float#
This property holds The starting angle of this slice in the series it belongs to. A full pie is 360 degrees, where 0 degrees is at 12 a’clock. Updated automatically once the slice is added to the series..
- Access functions:
startAngle
()Signal
startAngleChanged
()
- property PᅟySide6.QtCharts.QPieSlice.value: float#
This property holds The value of the slice..
- Access functions:
value
()setValue
(value)Signal
valueChanged
()
- PySide6.QtCharts.QPieSlice.LabelPosition#
This enum describes the position of the slice label.
Constant
Description
QPieSlice.LabelOutside
The label is located outside the slice connected to it with an arm. This is the default value.
QPieSlice.LabelInsideHorizontal
The label is centered within the slice and laid out horizontally.
QPieSlice.LabelInsideTangential
The label is centered within the slice and rotated to be parallel with the tangential of the slice’s arc.
QPieSlice.LabelInsideNormal
The label is centered within the slice and rotated to be parallel with the normal of the slice’s arc.
- PySide6.QtCharts.QPieSlice.angleSpan()#
- Return type:
float
Getter of property angleSpan
.
- PySide6.QtCharts.QPieSlice.angleSpanChanged()#
This signal is emitted when the angle span of the slice changes.
See also
Notification signal of property angleSpan
.
- PySide6.QtCharts.QPieSlice.borderColor()#
- Return type:
See also
Getter of property borderColor
.
- PySide6.QtCharts.QPieSlice.borderColorChanged()#
This signal is emitted when the slice border color changes.
See also
Notification signal of property borderColor
.
- PySide6.QtCharts.QPieSlice.borderWidth()#
- Return type:
int
See also
Getter of property borderWidth
.
- PySide6.QtCharts.QPieSlice.borderWidthChanged()#
This signal is emitted when the slice border width changes.
See also
Notification signal of property borderWidth
.
- PySide6.QtCharts.QPieSlice.brush()#
- Return type:
See also
Getter of property brush
.
- PySide6.QtCharts.QPieSlice.brushChanged()#
This signal is emitted when the brush used to fill the slice changes.
See also
Notification signal of property brush
.
- PySide6.QtCharts.QPieSlice.clicked()#
This signal is emitted when the slice is clicked.
See also
- PySide6.QtCharts.QPieSlice.color()#
- Return type:
See also
Getter of property color
.
- PySide6.QtCharts.QPieSlice.colorChanged()#
This signal is emitted when the slice color changes.
See also
Notification signal of property color
.
- PySide6.QtCharts.QPieSlice.doubleClicked()#
This signal is emitted when user double-clicks the slice.
See also
- PySide6.QtCharts.QPieSlice.explodeDistanceFactor()#
- Return type:
float
See also
Getter of property explodeDistanceFactor
.
- PySide6.QtCharts.QPieSlice.hovered(state)#
- Parameters:
state – bool
This signal is emitted when a mouse is hovered over the slice. When the mouse moves over the slice, state
turns true
, and when the mouse moves away again, it turns false
.
See also
- PySide6.QtCharts.QPieSlice.isExploded()#
- Return type:
bool
Getter of property exploded
.
- PySide6.QtCharts.QPieSlice.isLabelVisible()#
- Return type:
bool
Getter of property labelVisible
.
- PySide6.QtCharts.QPieSlice.label()#
- Return type:
str
See also
Getter of property label
.
- PySide6.QtCharts.QPieSlice.labelArmLengthFactor()#
- Return type:
float
See also
Getter of property labelArmLengthFactor
.
- PySide6.QtCharts.QPieSlice.labelBrush()#
- Return type:
See also
Getter of property labelBrush
.
- PySide6.QtCharts.QPieSlice.labelBrushChanged()#
This signal is emitted when the label brush of the slice changes.
See also
Notification signal of property labelBrush
.
- PySide6.QtCharts.QPieSlice.labelChanged()#
This signal is emitted when the slice label changes.
See also
Notification signal of property label
.
- PySide6.QtCharts.QPieSlice.labelColor()#
- Return type:
See also
Getter of property labelColor
.
- PySide6.QtCharts.QPieSlice.labelColorChanged()#
This signal is emitted when the slice label color changes.
See also
Notification signal of property labelColor
.
- PySide6.QtCharts.QPieSlice.labelFont()#
- Return type:
See also
Getter of property labelFont
.
- PySide6.QtCharts.QPieSlice.labelFontChanged()#
This signal is emitted when the label font of the slice changes.
See also
Notification signal of property labelFont
.
- PySide6.QtCharts.QPieSlice.labelPosition()#
- Return type:
See also
Getter of property labelPosition
.
- PySide6.QtCharts.QPieSlice.labelVisibleChanged()#
This signal is emitted when the visibility of the slice label changes.
See also
labelVisible
Notification signal of property labelVisible
.
- PySide6.QtCharts.QPieSlice.pen()#
- Return type:
See also
Getter of property pen
.
- PySide6.QtCharts.QPieSlice.penChanged()#
This signal is emitted when the pen used to draw the slice border changes.
See also
Notification signal of property pen
.
- PySide6.QtCharts.QPieSlice.percentage()#
- Return type:
float
Getter of property percentage
.
- PySide6.QtCharts.QPieSlice.percentageChanged()#
This signal is emitted when the percentage of the slice changes.
See also
Notification signal of property percentage
.
- PySide6.QtCharts.QPieSlice.pressed()#
This signal is emitted when the user clicks the slice and holds down the mouse button.
See also
- PySide6.QtCharts.QPieSlice.released()#
This signal is emitted when the user releases the mouse press on the slice.
See also
- PySide6.QtCharts.QPieSlice.series()#
- Return type:
Returns the series that this slice belongs to.
See also
- PySide6.QtCharts.QPieSlice.setBorderColor(color)#
- Parameters:
color –
PySide6.QtGui.QColor
See also
Setter of property borderColor
.
- PySide6.QtCharts.QPieSlice.setBorderWidth(width)#
- Parameters:
width – int
See also
Setter of property borderWidth
.
- PySide6.QtCharts.QPieSlice.setBrush(brush)#
- Parameters:
brush –
PySide6.QtGui.QBrush
See also
Setter of property brush
.
- PySide6.QtCharts.QPieSlice.setColor(color)#
- Parameters:
color –
PySide6.QtGui.QColor
See also
Setter of property color
.
- PySide6.QtCharts.QPieSlice.setExplodeDistanceFactor(factor)#
- Parameters:
factor – float
See also
Setter of property explodeDistanceFactor
.
- PySide6.QtCharts.QPieSlice.setExploded([exploded=true])#
- Parameters:
exploded – bool
See also
Setter of property exploded
.
Setter of property label
.
- PySide6.QtCharts.QPieSlice.setLabelArmLengthFactor(factor)#
- Parameters:
factor – float
See also
Setter of property labelArmLengthFactor
.
- PySide6.QtCharts.QPieSlice.setLabelBrush(brush)#
- Parameters:
brush –
PySide6.QtGui.QBrush
See also
Setter of property labelBrush
.
- PySide6.QtCharts.QPieSlice.setLabelColor(color)#
- Parameters:
color –
PySide6.QtGui.QColor
See also
Setter of property labelColor
.
- PySide6.QtCharts.QPieSlice.setLabelFont(font)#
- Parameters:
font –
PySide6.QtGui.QFont
See also
Setter of property labelFont
.
- PySide6.QtCharts.QPieSlice.setLabelPosition(position)#
- Parameters:
position –
LabelPosition
See also
Setter of property labelPosition
.
- PySide6.QtCharts.QPieSlice.setLabelVisible([visible=true])#
- Parameters:
visible – bool
See also
Setter of property labelVisible
.
- PySide6.QtCharts.QPieSlice.setPen(pen)#
- Parameters:
pen –
PySide6.QtGui.QPen
See also
Setter of property pen
.
Setter of property value
.
- PySide6.QtCharts.QPieSlice.startAngle()#
- Return type:
float
Getter of property startAngle
.
- PySide6.QtCharts.QPieSlice.startAngleChanged()#
This signal is emitted when the starting angle of the slice changes.
See also
Notification signal of property startAngle
.
- PySide6.QtCharts.QPieSlice.value()#
- Return type:
float
See also
Getter of property value
.
- PySide6.QtCharts.QPieSlice.valueChanged()#
This signal is emitted when the slice value changes.
See also
Notification signal of property value
.