Search code examples
pythonplotlydashboardplotly-python

Plotly indicators number rounding


When using Plotly (in python) with an indicator if the number is relatively big the number is rounded. How to avoid this (or at least control it)?

fig_ind_abs = go.Figure(go.Indicator(
        mode="number+delta",
        value=5222,
        delta={'position': "top", 'reference': 5218}))

will show the following indicator Result

Any ideas?


Solution

  • You need to format the indicator number. You should add {'valueformat':'f'} to your code wherever you need float values.Reference

    Full list of available customizations d3 format api

    import plotly.graph_objects as go
    go.Figure(go.Indicator(
            mode="number+delta",
            value=5222,
            delta={'position': "top", 'reference': 5218, 'valueformat':'f'},
            number = {'valueformat':'f'}
    ))
    

    enter image description here