Spaces:
Sleeping
Sleeping
GMARTINEZMILLA
commited on
Commit
•
accd0d7
1
Parent(s):
416d73b
feat: generated files
Browse files
app.py
CHANGED
@@ -81,31 +81,57 @@ elif page == "Customer Analysis":
|
|
81 |
# Crear el gráfico de radar
|
82 |
fig = go.Figure()
|
83 |
|
|
|
84 |
fig.add_trace(go.Scatterpolar(
|
85 |
-
r=values +
|
86 |
-
theta=manufacturers +
|
87 |
fill='toself',
|
88 |
-
|
89 |
-
|
90 |
-
fillcolor='rgba(0, 0, 255, 0.3)',
|
91 |
mode='lines+markers',
|
92 |
-
marker=dict(size=8, color='
|
93 |
))
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
fig.update_layout(
|
96 |
polar=dict(
|
97 |
radialaxis=dict(
|
98 |
visible=True,
|
99 |
-
range=[0,
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
),
|
102 |
-
title=f'Radar Chart for Top 6 Manufacturers of Customer {customer_code}',
|
103 |
showlegend=False,
|
104 |
-
|
105 |
-
|
106 |
)
|
107 |
|
108 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
st.plotly_chart(fig)
|
110 |
|
111 |
# Ventas del cliente 2021-2024 (si los datos existen)
|
@@ -121,7 +147,7 @@ elif page == "Customer Analysis":
|
|
121 |
st.warning("Sales data for 2021-2024 not available.")
|
122 |
else:
|
123 |
st.warning(f"No data found for customer {customer_code}. Please check the code.")
|
124 |
-
|
125 |
# Página Customer Recommendations
|
126 |
elif page == "Customer Recommendations":
|
127 |
st.title("Customer Recommendations")
|
|
|
81 |
# Crear el gráfico de radar
|
82 |
fig = go.Figure()
|
83 |
|
84 |
+
# Add the data trace (pink line)
|
85 |
fig.add_trace(go.Scatterpolar(
|
86 |
+
r=values + values[:1], # Repeat first value to close the polygon
|
87 |
+
theta=manufacturers + manufacturers[:1],
|
88 |
fill='toself',
|
89 |
+
fillcolor='rgba(255, 105, 180, 0.2)', # Light pink fill
|
90 |
+
line=dict(color='rgb(255, 105, 180)', width=2), # Pink line
|
|
|
91 |
mode='lines+markers',
|
92 |
+
marker=dict(size=8, color='rgb(255, 105, 180)') # Pink markers
|
93 |
))
|
94 |
|
95 |
+
# Add the outer boundary (blue line)
|
96 |
+
fig.add_trace(go.Scatterpolar(
|
97 |
+
r=[1]*len(manufacturers) + [1], # A list of 1's to create the outer boundary
|
98 |
+
theta=manufacturers + manufacturers[:1],
|
99 |
+
mode='lines',
|
100 |
+
line=dict(color='rgb(100, 149, 237)', width=2), # Cornflower blue
|
101 |
+
showlegend=False
|
102 |
+
))
|
103 |
+
|
104 |
+
# Update the layout
|
105 |
fig.update_layout(
|
106 |
polar=dict(
|
107 |
radialaxis=dict(
|
108 |
visible=True,
|
109 |
+
range=[0, 1],
|
110 |
+
showline=False,
|
111 |
+
showticklabels=False,
|
112 |
+
),
|
113 |
+
angularaxis=dict(
|
114 |
+
showline=True,
|
115 |
+
linecolor='rgb(192, 192, 192)', # Light gray
|
116 |
+
tickcolor='rgb(192, 192, 192)',
|
117 |
+
),
|
118 |
+
gridshape='circular',
|
119 |
),
|
|
|
120 |
showlegend=False,
|
121 |
+
paper_bgcolor='white',
|
122 |
+
plot_bgcolor='white',
|
123 |
)
|
124 |
|
125 |
+
# Add radial grid lines
|
126 |
+
for i in range(1, 5): # 4 concentric circles
|
127 |
+
fig.add_shape(
|
128 |
+
type="circle",
|
129 |
+
xref="x", yref="y",
|
130 |
+
x0=-i/4, y0=-i/4, x1=i/4, y1=i/4,
|
131 |
+
line=dict(color="rgb(192, 192, 192)", width=1),
|
132 |
+
)
|
133 |
+
|
134 |
+
# Show the plot in Streamlit
|
135 |
st.plotly_chart(fig)
|
136 |
|
137 |
# Ventas del cliente 2021-2024 (si los datos existen)
|
|
|
147 |
st.warning("Sales data for 2021-2024 not available.")
|
148 |
else:
|
149 |
st.warning(f"No data found for customer {customer_code}. Please check the code.")
|
150 |
+
|
151 |
# Página Customer Recommendations
|
152 |
elif page == "Customer Recommendations":
|
153 |
st.title("Customer Recommendations")
|