Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Multiple formats in text template

$
0
0

Hi,

I am attempting to format my text in a waterfall chart where each text value has a “M” annotation at the end and is rounded to a two decimal precision. Following is my code block that generates the waterfall chart and snapshot of the waterfall chart.

fig = go.Figure(
        go.Waterfall(name='Case Eq.', orientation='v',
                     measure=['absolute', 'relative', 'relative', 'relative', 'relative', 'relative', 'relative', 'total'],
                     textposition='outside',
                     text=[str(x) for x in value],
                     texttemplate='%{value: .2f, s}',
                     x = index,
                     y = value,
                     connector={'line': {"color":"rgb(63, 63, 63)"}}))

The first format option of “.2f” takes effect but not second one (s - that shows data in millions M). If I change the order, the first format always takes effect.

I referred to this link where formatting options are comma separated. https://plotly.com/python/text-and-annotations/#customize-displayed-text-with-a-text-template

I referred to this previous post as well but no luck. https://community.plotly.com/t/decimal-precision-in-pie-charts/31731/2

Any help is much appreciated.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles