PySide6.QtGraphs.QPieSlice¶
- class QPieSlice¶
The
QPieSlice
class represents a single slice in a pie series. More…Added in version 6.8.
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 sliceborderWidthᅟ
- Width of the slice border. This is a convenience property for modifying the slice border widthcolorᅟ
- Fill color of the slice. This is a convenience property for modifying the slice fill colorexplodeDistanceFactorᅟ
- 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:labelColorᅟ
- Color used to draw the slice labellabelFontᅟ
- Font used for drawing the label textlabelPositionᅟ
- Position of the slice labellabelVisibleᅟ
- Visibility of the slice label. By default, the label is not visiblepercentageᅟ
- 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
Methods¶
def
__init__()
def
angleSpan()
def
borderColor()
def
borderWidth()
def
color()
def
isExploded()
def
isLabelVisible()
def
label()
def
labelColor()
def
labelFont()
def
labelPosition()
def
percentage()
def
series()
def
setBorderColor()
def
setBorderWidth()
def
setColor()
def
setExploded()
def
setLabel()
def
setLabelColor()
def
setLabelFont()
def
setValue()
def
startAngle()
def
value()
Signals¶
def
colorChanged()
def
labelChanged()
def
sliceChanged()
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 graph.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 graph, some basic signals are emitted when users click pie slices or hover the mouse over them.
See also
- class LabelPosition¶
This enum describes the position of the slice label.
Constant
Description
QPieSlice.LabelPosition.LabelPosition.Outside
The label is located outside the slice connected to it with an arm. This is the default value.
QPieSlice.LabelPosition.LabelPosition.InsideHorizontal
The label is centered within the slice and laid out horizontally.
QPieSlice.LabelPosition.LabelPosition.InsideTangential
The label is centered within the slice and rotated to be parallel with the tangential of the slice’s arc.
QPieSlice.LabelPosition.LabelPosition.InsideNormal
The label is centered within the slice and rotated to be parallel with the normal of the slice’s arc.
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property 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:
Signal
angleSpanChanged()
This property holds The color used to draw the slice border. This is a convenience property for modifying the slice..
See also
- Access functions:
- property borderWidthᅟ: float¶
This property holds The width of the slice border. This is a convenience property for modifying the slice border width..
See also
- Access functions:
This property holds The fill color of the slice. This is a convenience property for modifying the slice fill color..
- Access functions:
Signal
colorChanged()
- property 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:
- property explodedᅟ: bool¶
This property holds Whether the slice is separated from the pie..
See also
- Access functions:
- property labelᅟ: str¶
This property holds The label of the slice..
- Access functions:
Signal
labelChanged()
- property 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
- Access functions:
This property holds The color used to draw the slice label..
- Access functions:
This property holds The font used for drawing the label text..
See also
label
labelVisible
labelArmLengthFactor
- Access functions:
- property labelPositionᅟ: QPieSlice.LabelPosition¶
This property holds The position of the slice label..
See also
label
labelVisible
- Access functions:
- property labelVisibleᅟ: bool¶
This property holds The visibility of the slice label. By default, the label is not visible..
See also
- Access functions:
- property 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:
Signal
percentageChanged()
- property 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:
Signal
startAngleChanged()
- property valueᅟ: float¶
This property holds The value of the slice..
- Access functions:
Signal
valueChanged()
Constructs an empty slice with the parent
parent
.- __init__(label, value[, parent=None])
- Parameters:
label – str
value – float
parent –
QObject
Constructs an empty slice with the specified
value
,label
, andparent
.- angleSpan()¶
- Return type:
float
Getter of property
angleSpanᅟ
.- angleSpanChanged()¶
Notification signal of property
angleSpanᅟ
.- borderColor()¶
- Return type:
See also
Getter of property
borderColorᅟ
.- borderColorChanged()¶
Notification signal of property
borderColorᅟ
.- borderWidth()¶
- Return type:
float
See also
Getter of property
borderWidthᅟ
.- borderWidthChanged()¶
Notification signal of property
borderWidthᅟ
.- color()¶
- Return type:
See also
Getter of property
colorᅟ
.- colorChanged()¶
Notification signal of property
colorᅟ
.- explodeDistanceFactor()¶
- Return type:
float
See also
Getter of property
explodeDistanceFactorᅟ
.- explodeDistanceFactorChanged()¶
Notification signal of property
explodeDistanceFactorᅟ
.- explodedChanged()¶
Notification signal of property
explodedᅟ
.- isExploded()¶
- Return type:
bool
Getter of property
explodedᅟ
.- isLabelVisible()¶
- Return type:
bool
Getter of property
labelVisibleᅟ
.- label()¶
- Return type:
str
See also
Getter of property
labelᅟ
.- labelArmLengthFactor()¶
- Return type:
float
See also
Getter of property
labelArmLengthFactorᅟ
.- labelArmLengthFactorChanged()¶
Notification signal of property
labelArmLengthFactorᅟ
.- labelChanged()¶
Notification signal of property
labelᅟ
.- labelColor()¶
- Return type:
See also
Getter of property
labelColorᅟ
.- labelColorChanged()¶
Notification signal of property
labelColorᅟ
.- labelFont()¶
- Return type:
See also
Getter of property
labelFontᅟ
.- labelFontChanged()¶
Notification signal of property
labelFontᅟ
.- labelPosition()¶
- Return type:
See also
Getter of property
labelPositionᅟ
.- labelPositionChanged()¶
Notification signal of property
labelPositionᅟ
.- labelVisibleChanged()¶
Notification signal of property
labelVisibleᅟ
.- percentage()¶
- Return type:
float
Getter of property
percentageᅟ
.- percentageChanged()¶
Notification signal of property
percentageᅟ
.- series()¶
- Return type:
Returns the series that this slice belongs to.
See also
Setter of property
borderColorᅟ
.- setBorderWidth(borderWidth)¶
- Parameters:
borderWidth – float
See also
Setter of property
borderWidthᅟ
.Setter of property
colorᅟ
.- setExplodeDistanceFactor(factor)¶
- Parameters:
factor – float
See also
Setter of property
explodeDistanceFactorᅟ
.- setExploded(exploded)¶
- Parameters:
exploded – bool
See also
Setter of property
explodedᅟ
.Setter of property
labelᅟ
.- setLabelArmLengthFactor(factor)¶
- Parameters:
factor – float
See also
Setter of property
labelArmLengthFactorᅟ
.Setter of property
labelColorᅟ
.Setter of property
labelFontᅟ
.- setLabelPosition(position)¶
- Parameters:
position –
LabelPosition
See also
Setter of property
labelPositionᅟ
.- setLabelVisible([visible=true])¶
- Parameters:
visible – bool
See also
Setter of property
labelVisibleᅟ
.Setter of property
valueᅟ
.- sliceChanged()¶
- startAngle()¶
- Return type:
float
Getter of property
startAngleᅟ
.- startAngleChanged()¶
Notification signal of property
startAngleᅟ
.- value()¶
- Return type:
float
See also
Getter of property
valueᅟ
.- valueChanged()¶
Notification signal of property
valueᅟ
.