Update app.py
Browse files
app.py
CHANGED
@@ -74,21 +74,21 @@ with ui.layout_columns(col_widths=[6, 6, 12]):
|
|
74 |
ui.card_header("Tips data")
|
75 |
|
76 |
@render.data_frame
|
77 |
-
def table():
|
78 |
-
|
79 |
-
|
80 |
-
@render_plotly
|
81 |
-
def scatterplot():
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
with ui.card(full_screen=True):
|
93 |
with ui.card_header(class_="d-flex justify-content-between align-items-center"):
|
94 |
"Tip percentages"
|
|
|
74 |
ui.card_header("Tips data")
|
75 |
|
76 |
@render.data_frame
|
77 |
+
def table():
|
78 |
+
return tips_data() # جدول با دادههای فیلتر شده
|
79 |
+
|
80 |
+
@render_plotly
|
81 |
+
def scatterplot():
|
82 |
+
data = tips_data() # دادههای فیلتر شده برای نمودار
|
83 |
+
if data.shape[0] == 0:
|
84 |
+
return {} # اگر هیچ دادهای نیست، نمودار خالی برگردانده میشود
|
85 |
+
return px.scatter(
|
86 |
+
data,
|
87 |
+
x="سن", # استفاده از ستون "سن"
|
88 |
+
y="id", # استفاده از ستون "id"
|
89 |
+
color=None if input.scatter_color() == "none" else input.scatter_color(), # رنگ بر اساس انتخاب
|
90 |
+
trendline="lowess", # اضافه کردن trendline به نمودار
|
91 |
+
)
|
92 |
with ui.card(full_screen=True):
|
93 |
with ui.card_header(class_="d-flex justify-content-between align-items-center"):
|
94 |
"Tip percentages"
|