-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathpiechart_control.py
More file actions
43 lines (35 loc) · 1.07 KB
/
piechart_control.py
File metadata and controls
43 lines (35 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import datetime
import random
import time
import pglet
from pglet import Text, PieChart
from pglet.piechart import Point
def main(page):
# simple donut-like pie chart
chart1 = PieChart(
width="50%",
inner_radius=40,
inner_value=42,
points=[Point(color="yellow", value=10), Point(color="green", value=32)],
)
# pie chart with legent
chart2 = PieChart(
width="50%",
legend=True,
tooltips=True,
points=[
Point(legend="Free space", value=10, tooltip="10%"),
Point(legend="Total space", value=20, tooltip="20%"),
Point(legend="Reserved space", value=30, tooltip="30%"),
Point(legend="A:", value=20, tooltip="20%"),
Point(legend="B:", value=20, tooltip="20%"),
Point(legend="C:", value=20, tooltip="20%"),
],
)
page.add(
Text("Donut-like PieChart", size="xLarge"),
chart1,
Text("PieChart with legend and tooltips", size="xLarge"),
chart2,
)
pglet.app("python-piechart", target=main)