-
Notifications
You must be signed in to change notification settings - Fork 654
Expand file tree
/
Copy pathexample_1.py
More file actions
96 lines (92 loc) · 3.22 KB
/
example_1.py
File metadata and controls
96 lines (92 loc) · 3.22 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import flet as ft
import flet_charts as fch
def main(page: ft.Page):
page.add(
fch.BarChart(
expand=True,
interactive=True,
max_y=110,
border=ft.Border.all(1, ft.Colors.GREY_400),
horizontal_grid_lines=fch.ChartGridLines(
color=ft.Colors.GREY_300, width=1, dash_pattern=[3, 3]
),
tooltip=fch.BarChartTooltip(
bgcolor=ft.Colors.with_opacity(0.5, ft.Colors.GREY_300),
border_radius=ft.BorderRadius.all(20),
),
left_axis=fch.ChartAxis(
label_size=40, title=ft.Text("Fruit supply"), title_size=40
),
right_axis=fch.ChartAxis(show_labels=False),
bottom_axis=fch.ChartAxis(
label_size=40,
labels=[
fch.ChartAxisLabel(
value=0, label=ft.Container(ft.Text("Apple"), padding=10)
),
fch.ChartAxisLabel(
value=1, label=ft.Container(ft.Text("Blueberry"), padding=10)
),
fch.ChartAxisLabel(
value=2, label=ft.Container(ft.Text("Cherry"), padding=10)
),
fch.ChartAxisLabel(
value=3, label=ft.Container(ft.Text("Orange"), padding=10)
),
],
),
groups=[
fch.BarChartGroup(
x=0,
rods=[
fch.BarChartRod(
from_y=0,
to_y=40,
width=40,
color=ft.Colors.GREEN,
border_radius=0,
),
],
),
fch.BarChartGroup(
x=1,
rods=[
fch.BarChartRod(
from_y=0,
to_y=100,
width=40,
color=ft.Colors.BLUE,
tooltip=fch.BarChartRodTooltip("Blueberry"),
border_radius=0,
),
],
),
fch.BarChartGroup(
x=2,
rods=[
fch.BarChartRod(
from_y=0,
to_y=30,
width=40,
color=ft.Colors.RED,
border_radius=0,
),
],
),
fch.BarChartGroup(
x=3,
rods=[
fch.BarChartRod(
from_y=0,
to_y=60,
width=40,
color=ft.Colors.ORANGE,
tooltip=fch.BarChartRodTooltip("Orange"),
border_radius=0,
),
],
),
],
)
)
ft.run(main)