Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -763,18 +763,20 @@ try:
|
|
763 |
bar_columns = st.sidebar.multiselect('Which columns should be displayed as bar charts?', sorted(funnel_percentage.columns))
|
764 |
line_columns = st.sidebar.multiselect('Which columns should be displayed as line charts?', sorted(funnel_percentage.columns))
|
765 |
|
766 |
-
# Sort by selection
|
767 |
-
sort_by = st.sidebar.selectbox("Sort by:", sorted(funnel_percentage.columns))
|
768 |
-
ascending = st.sidebar.checkbox("Ascending order?", value=False) # Default to descending order
|
769 |
-
|
770 |
funnel_percentage_cleaned = funnel_percentage.dropna(axis=0, how='all')
|
771 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
772 |
|
773 |
fig = go.Figure()
|
774 |
|
775 |
# Define modern and diverse color palette
|
776 |
modern_colors = [
|
777 |
-
"#FF6F61", "#6B5B95", "#88B04B", "#F7CAC9", "#92A8D1",
|
778 |
"#955251", "#B565A7", "#009B77", "#DD4124", "#45B8AC"
|
779 |
]
|
780 |
|
@@ -783,8 +785,8 @@ try:
|
|
783 |
funnel_percentage_col = funnel_percentage_cleaned[col]
|
784 |
fig.add_trace(
|
785 |
go.Bar(
|
786 |
-
x=funnel_percentage_cleaned.index,
|
787 |
-
y=funnel_percentage_col,
|
788 |
name=col,
|
789 |
marker_color=modern_colors[idx % len(modern_colors)], # Cycle through colors
|
790 |
opacity=0.8 # Set transparency
|
@@ -796,9 +798,9 @@ try:
|
|
796 |
funnel_percentage_col = funnel_percentage_cleaned[col]
|
797 |
fig.add_trace(
|
798 |
go.Scatter(
|
799 |
-
x=funnel_percentage_cleaned.index,
|
800 |
-
y=funnel_percentage_col,
|
801 |
-
mode='lines',
|
802 |
name=col,
|
803 |
line=dict(color=modern_colors[(idx + len(bar_columns)) % len(modern_colors)]), # Cycle through colors
|
804 |
opacity=0.8 # Set transparency
|
@@ -815,6 +817,7 @@ try:
|
|
815 |
)
|
816 |
|
817 |
st.plotly_chart(fig)
|
|
|
818 |
|
819 |
elif main_option == "Segmentation Analysis":
|
820 |
st.header("Segmentation Analysis")
|
|
|
763 |
bar_columns = st.sidebar.multiselect('Which columns should be displayed as bar charts?', sorted(funnel_percentage.columns))
|
764 |
line_columns = st.sidebar.multiselect('Which columns should be displayed as line charts?', sorted(funnel_percentage.columns))
|
765 |
|
|
|
|
|
|
|
|
|
766 |
funnel_percentage_cleaned = funnel_percentage.dropna(axis=0, how='all')
|
767 |
+
|
768 |
+
# اضافه کردن انتخاب ترتیب مرتبسازی
|
769 |
+
columns = st.sidebar.multiselect('Sort by which questions?', sorted(funnel_percentage_cleaned.columns))
|
770 |
+
sort_order = st.sidebar.radio('Sort Order', ['Ascending', 'Descending'])
|
771 |
+
|
772 |
+
ascending = True if sort_order == 'Ascending' else False
|
773 |
+
funnel_percentage_cleaned = funnel_percentage_cleaned.sort_values(by=columns, ascending=ascending)
|
774 |
|
775 |
fig = go.Figure()
|
776 |
|
777 |
# Define modern and diverse color palette
|
778 |
modern_colors = [
|
779 |
+
"#FF6F61", "#6B5B95", "#88B04B", "#F7CAC9", "#92A8D1",
|
780 |
"#955251", "#B565A7", "#009B77", "#DD4124", "#45B8AC"
|
781 |
]
|
782 |
|
|
|
785 |
funnel_percentage_col = funnel_percentage_cleaned[col]
|
786 |
fig.add_trace(
|
787 |
go.Bar(
|
788 |
+
x=funnel_percentage_cleaned.index,
|
789 |
+
y=funnel_percentage_col,
|
790 |
name=col,
|
791 |
marker_color=modern_colors[idx % len(modern_colors)], # Cycle through colors
|
792 |
opacity=0.8 # Set transparency
|
|
|
798 |
funnel_percentage_col = funnel_percentage_cleaned[col]
|
799 |
fig.add_trace(
|
800 |
go.Scatter(
|
801 |
+
x=funnel_percentage_cleaned.index,
|
802 |
+
y=funnel_percentage_col,
|
803 |
+
mode='lines',
|
804 |
name=col,
|
805 |
line=dict(color=modern_colors[(idx + len(bar_columns)) % len(modern_colors)]), # Cycle through colors
|
806 |
opacity=0.8 # Set transparency
|
|
|
817 |
)
|
818 |
|
819 |
st.plotly_chart(fig)
|
820 |
+
|
821 |
|
822 |
elif main_option == "Segmentation Analysis":
|
823 |
st.header("Segmentation Analysis")
|