aboutsummaryrefslogtreecommitdiffstats
path: root/examples/charts/donutbreakdown/donutbreakdown.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/charts/donutbreakdown/donutbreakdown.py')
-rw-r--r--examples/charts/donutbreakdown/donutbreakdown.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/charts/donutbreakdown/donutbreakdown.py b/examples/charts/donutbreakdown/donutbreakdown.py
index b724857d3..27faa6e94 100644
--- a/examples/charts/donutbreakdown/donutbreakdown.py
+++ b/examples/charts/donutbreakdown/donutbreakdown.py
@@ -47,6 +47,7 @@ from PySide6.QtGui import QColor, QFont, QPainter, QScreen
from PySide6.QtWidgets import QApplication, QMainWindow
from PySide6.QtCharts import QChart, QChartView, QPieSeries, QPieSlice
+
class MainSlice(QPieSlice):
def __init__(self, breakdown_series, parent=None):
super().__init__(parent)
@@ -119,7 +120,7 @@ class DonutBreakdownChart(QChart):
for pie_slice in slices:
breakdown_series = pie_slice.get_breakdown_series()
breakdown_series.setPieStartAngle(angle)
- angle += pie_slice.percentage() * 360.0 # full pie is 360.0
+ angle += pie_slice.percentage() * 360.0 # full pie is 360.0
breakdown_series.setPieEndAngle(angle)
def update_legend_markers(self):
@@ -137,6 +138,7 @@ class DonutBreakdownChart(QChart):
marker.setLabel(f"{label} {p:.2f}%")
marker.setFont(QFont("Arial", 8))
+
if __name__ == "__main__":
app = QApplication(sys.argv)
# Graph is based on data of: