Spaces:
Running
Running
Update src/modules/ml_dashboard.py
Browse files- src/modules/ml_dashboard.py +50 -54
src/modules/ml_dashboard.py
CHANGED
|
@@ -214,62 +214,58 @@ def show_ml_features(client, sheet_name):
|
|
| 214 |
elif mois_actuel > 0:
|
| 215 |
benefices_mensuels.loc[i, 'Variation'] = 100.0
|
| 216 |
|
| 217 |
-
#
|
| 218 |
-
|
| 219 |
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
'
|
| 257 |
-
|
| 258 |
-
yaxis={
|
| 259 |
-
'title': {
|
| 260 |
-
'text': 'Bénéfices (XOF)',
|
| 261 |
-
'font': {'size': 13, 'family': 'Space Grotesk'}
|
| 262 |
-
},
|
| 263 |
-
'gridcolor': 'rgba(48, 54, 61, 0.3)',
|
| 264 |
-
'linecolor': 'rgba(48, 54, 61, 0.5)',
|
| 265 |
-
'tickfont': {'family': 'Space Grotesk', 'size': 12}
|
| 266 |
},
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
|
| 274 |
# === TREEMAP DES VARIATIONS MENSUELLES ===
|
| 275 |
st.markdown("<h3 style='font-size: 1.1rem; color: #8b949e; margin-top: 32px; margin-bottom: 16px;'>Répartition mensuelle des bénéfices</h3>", unsafe_allow_html=True)
|
|
|
|
| 214 |
elif mois_actuel > 0:
|
| 215 |
benefices_mensuels.loc[i, 'Variation'] = 100.0
|
| 216 |
|
| 217 |
+
# Graphique en barres avec Plotly (pleine largeur)
|
| 218 |
+
fig_mensuel = go.Figure()
|
| 219 |
|
| 220 |
+
# Barres des bénéfices
|
| 221 |
+
fig_mensuel.add_trace(go.Bar(
|
| 222 |
+
x=benefices_mensuels['Mois_Nom'],
|
| 223 |
+
y=benefices_mensuels['Benefice'],
|
| 224 |
+
name='Bénéfices',
|
| 225 |
+
marker=dict(
|
| 226 |
+
color='#58a6ff',
|
| 227 |
+
line=dict(color='rgba(139, 148, 158, 0.3)', width=1.5)
|
| 228 |
+
),
|
| 229 |
+
text=benefices_mensuels['Benefice'].apply(lambda x: f"{x:,.0f}".replace(',', ' ')),
|
| 230 |
+
textposition='outside',
|
| 231 |
+
textfont=dict(size=12, color='#c9d1d9', family='Space Grotesk'),
|
| 232 |
+
opacity=0.85,
|
| 233 |
+
hovertemplate='<b>%{x}</b><br>Bénéfice: %{y:,.0f} XOF<extra></extra>'
|
| 234 |
+
))
|
| 235 |
+
|
| 236 |
+
# Mise en forme
|
| 237 |
+
fig_mensuel.update_layout(
|
| 238 |
+
title={
|
| 239 |
+
'text': 'Évolution des bénéfices mensuels (2026)',
|
| 240 |
+
'font': {'size': 16, 'color': '#c9d1d9', 'family': 'Space Grotesk'},
|
| 241 |
+
'x': 0,
|
| 242 |
+
'xanchor': 'left'
|
| 243 |
+
},
|
| 244 |
+
plot_bgcolor='rgba(13, 17, 23, 0.8)',
|
| 245 |
+
paper_bgcolor='rgba(22, 27, 34, 0.3)',
|
| 246 |
+
font={'color': '#8b949e', 'family': 'Space Grotesk', 'size': 12},
|
| 247 |
+
xaxis={
|
| 248 |
+
'title': '',
|
| 249 |
+
'gridcolor': 'rgba(48, 54, 61, 0.3)',
|
| 250 |
+
'linecolor': 'rgba(48, 54, 61, 0.5)',
|
| 251 |
+
'tickfont': {'family': 'Space Grotesk', 'size': 13},
|
| 252 |
+
'tickangle': -45
|
| 253 |
+
},
|
| 254 |
+
yaxis={
|
| 255 |
+
'title': {
|
| 256 |
+
'text': 'Bénéfices (XOF)',
|
| 257 |
+
'font': {'size': 13, 'family': 'Space Grotesk'}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
},
|
| 259 |
+
'gridcolor': 'rgba(48, 54, 61, 0.3)',
|
| 260 |
+
'linecolor': 'rgba(48, 54, 61, 0.5)',
|
| 261 |
+
'tickfont': {'family': 'Space Grotesk', 'size': 12}
|
| 262 |
+
},
|
| 263 |
+
showlegend=False,
|
| 264 |
+
height=550,
|
| 265 |
+
margin=dict(t=80, b=120, l=80, r=30)
|
| 266 |
+
)
|
| 267 |
+
|
| 268 |
+
st.plotly_chart(fig_mensuel, use_container_width=True)
|
| 269 |
|
| 270 |
# === TREEMAP DES VARIATIONS MENSUELLES ===
|
| 271 |
st.markdown("<h3 style='font-size: 1.1rem; color: #8b949e; margin-top: 32px; margin-bottom: 16px;'>Répartition mensuelle des bénéfices</h3>", unsafe_allow_html=True)
|