Plotly Dash - Change number abbreviations format

336 views Asked by At

I have lots of tables and plots shown about transactions on my web app, with the frontend based on Dash. The issue is that Plotly uses d3 format to format all numbers, and d3 format doesn't include "Million" & "Billion". Therefore, I'm getting the abbreviations "G" & "T", that are used for example in "gigabytes" or "terabytes".

Do you know any way of changing those ? I haven't found anything relevant online...

Here are some examples: Barplot Table

For the table, here is the corresponding code:

  format_number = Format().precision(2).scheme("s")
  format_amount = Format().precision(2).scheme("s").symbol(Symbol.yes).symbol_suffix(" €")

  table = DataTable(
        columns=[
            {
                "name": ["Transactions", "Total number"],
                "id": "nb_operation",
                "type": "numeric",
                "format": format_number,
            },
            {
                "name": ["Transactions", "Total amount"],
                "id": "amount_euro",
                "type": "numeric",
                "format": format_amount,
            },
        ],
[...]

0

There are 0 answers