-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbarchart_control.py
More file actions
42 lines (35 loc) · 1.03 KB
/
barchart_control.py
File metadata and controls
42 lines (35 loc) · 1.03 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
import pglet
from pglet import Text, BarChart
from pglet.barchart import Point
def main(page):
# Fractions BarChart
chart1 = BarChart(
data_mode="fraction",
width="50%",
tooltips=True,
points=[
Point(
legend="C:", x=20, y=250, x_tooltip="20%", y_tooltip="20 of 250 GB used"
),
Point(legend="D:", x=50, y=250, x_tooltip="50%"),
Point(legend="E:", x=30, y=250, x_tooltip="30%"),
],
)
# Percentage BarChart
chart2 = BarChart(
data_mode="percentage",
width="30%",
tooltips=True,
points=[
Point(legend="/disk1", x=20, y=100, color="green"),
Point(legend="/disk2", x=50, y=100, color="yellow"),
Point(legend="/disk3", x=90, y=100, color="red"),
],
)
page.add(
Text("Fractions BarChart", size="xLarge"),
chart1,
Text("Percentage BarChart", size="xLarge"),
chart2,
)
pglet.app("python-barchart", target=main)