klydekushy commited on
Commit
d2eb9f3
·
verified ·
1 Parent(s): 75cb0f7

Update src/modules/ml_dashboard.py

Browse files
Files changed (1) hide show
  1. 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
- # Affichage en 2 colonnes
218
- col_graph, col_table = st.columns([3, 1])
219
 
220
- with col_graph:
221
- # Graphique en barres avec Plotly
222
- fig_mensuel = go.Figure()
223
-
224
- # Barres des bénéfices
225
- fig_mensuel.add_trace(go.Bar(
226
- x=benefices_mensuels['Mois_Nom'],
227
- y=benefices_mensuels['Benefice'],
228
- name='Bénéfices',
229
- marker=dict(
230
- color='#58a6ff',
231
- line=dict(color='rgba(139, 148, 158, 0.3)', width=1.5)
232
- ),
233
- text=benefices_mensuels['Benefice'].apply(lambda x: f"{x:,.0f}".replace(',', ' ')),
234
- textposition='outside',
235
- textfont=dict(size=12, color='#c9d1d9', family='Space Grotesk'),
236
- opacity=0.85,
237
- hovertemplate='<b>%{x}</b><br>Bénéfice: %{y:,.0f} XOF<extra></extra>'
238
- ))
239
-
240
- # Mise en forme
241
- fig_mensuel.update_layout(
242
- title={
243
- 'text': 'Évolution des bénéfices mensuels (2026)',
244
- 'font': {'size': 16, 'color': '#c9d1d9', 'family': 'Space Grotesk'},
245
- 'x': 0,
246
- 'xanchor': 'left'
247
- },
248
- plot_bgcolor='rgba(13, 17, 23, 0.8)',
249
- paper_bgcolor='rgba(22, 27, 34, 0.3)',
250
- font={'color': '#8b949e', 'family': 'Space Grotesk', 'size': 12},
251
- xaxis={
252
- 'title': '',
253
- 'gridcolor': 'rgba(48, 54, 61, 0.3)',
254
- 'linecolor': 'rgba(48, 54, 61, 0.5)',
255
- 'tickfont': {'family': 'Space Grotesk', 'size': 13},
256
- 'tickangle': -45
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
- showlegend=False,
268
- height=550,
269
- margin=dict(t=80, b=120, l=80, r=30)
270
- )
271
-
272
- st.plotly_chart(fig_mensuel, use_container_width=True)
 
 
 
 
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)