Spaces:
Sleeping
Sleeping
GMARTINEZMILLA
commited on
Commit
•
433fed0
1
Parent(s):
5307a00
feat: updated app script
Browse files
app.py
CHANGED
@@ -91,6 +91,35 @@ def get_supplier_name(code):
|
|
91 |
name = nombres_proveedores[nombres_proveedores['codigo'] == code]['nombre'].values
|
92 |
return name[0] if len(name) > 0 else code
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
# Function to create radar chart with square root transformation
|
95 |
def radar_chart(categories, values, amounts, title):
|
96 |
N = len(categories)
|
@@ -161,9 +190,12 @@ if page == "Summary":
|
|
161 |
st.markdown('#### States Migration')
|
162 |
|
163 |
# Create a placeholder for your own donut charts with Plotly
|
164 |
-
|
165 |
-
|
166 |
-
|
|
|
|
|
|
|
167 |
st.plotly_chart(donut_fig, use_container_width=True)
|
168 |
|
169 |
|
|
|
91 |
name = nombres_proveedores[nombres_proveedores['codigo'] == code]['nombre'].values
|
92 |
return name[0] if len(name) > 0 else code
|
93 |
|
94 |
+
# Custom Donut Chart with Plotly for Inbound/Outbound Percentage
|
95 |
+
def create_donut_chart(values, labels, color_scheme, title):
|
96 |
+
fig = px.pie(
|
97 |
+
values=values,
|
98 |
+
names=labels,
|
99 |
+
hole=0.7, # Adjusting the hole size for a modern look
|
100 |
+
color_discrete_sequence=color_scheme # Set color scheme
|
101 |
+
)
|
102 |
+
|
103 |
+
# Styling adjustments to center the percentage
|
104 |
+
fig.update_traces(
|
105 |
+
textinfo='percent+label',
|
106 |
+
hoverinfo='label+percent',
|
107 |
+
textposition='inside',
|
108 |
+
showlegend=False
|
109 |
+
)
|
110 |
+
|
111 |
+
# Layout adjustments
|
112 |
+
fig.update_layout(
|
113 |
+
annotations=[dict(text=f"{int(values[1])}%", x=0.5, y=0.5, font_size=40, showarrow=False)], # Center percentage text
|
114 |
+
title=title,
|
115 |
+
height=300, # Adjust the size
|
116 |
+
margin=dict(t=30, b=10, l=10, r=10),
|
117 |
+
paper_bgcolor="rgba(0, 0, 0, 0)", # Background color transparent
|
118 |
+
plot_bgcolor="rgba(0, 0, 0, 0)"
|
119 |
+
)
|
120 |
+
|
121 |
+
return fig
|
122 |
+
|
123 |
# Function to create radar chart with square root transformation
|
124 |
def radar_chart(categories, values, amounts, title):
|
125 |
N = len(categories)
|
|
|
190 |
st.markdown('#### States Migration')
|
191 |
|
192 |
# Create a placeholder for your own donut charts with Plotly
|
193 |
+
inbound_values = [23, 77] # Adjust the values
|
194 |
+
labels = ['Outbound', 'Inbound']
|
195 |
+
color_scheme = ['#155F7A', '#29b5e8']
|
196 |
+
title = 'States Migration'
|
197 |
+
|
198 |
+
donut_fig = create_donut_chart(inbound_values, labels, color_scheme, title)
|
199 |
st.plotly_chart(donut_fig, use_container_width=True)
|
200 |
|
201 |
|