Ekow24 commited on
Commit
1906941
·
verified ·
1 Parent(s): 3160fb9

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +8 -1
utils.py CHANGED
@@ -226,4 +226,11 @@ def build_payment_method_pie_chart(
226
  )
227
  fig.update_traces(hovertemplate="%{label}: £%{value:.2f} (%{percent})")
228
  fig.update_layout(margin=dict(l=10, r=10, t=40, b=10), template=template)
229
- return fig
 
 
 
 
 
 
 
 
226
  )
227
  fig.update_traces(hovertemplate="%{label}: £%{value:.2f} (%{percent})")
228
  fig.update_layout(margin=dict(l=10, r=10, t=40, b=10), template=template)
229
+ return fig
230
+
231
+ def _format_number(n: float) -> str:
232
+ if n >= 1_000_000:
233
+ return f"£{n/1_000_000:.1f}M"
234
+ if n >= 1_000:
235
+ return f"£{n/1_000:.1f}k"
236
+ return f"£{n:,.0f}"