Hi there,
I would like to format the numbers in the hovertemplate accorting to their height:
2 decimal places if the number is under 10,
1 decimal place if the number is under 100,
0 decimal places if the number is above or equal 100
The closest I’ve come to what I want is this:
hovertemplate= (
'%{y:,.2f}' if '%{y:.0f}' < '10' else
'%{y:,.1f}' if '%{y:.0f}' < '100' else
'%{y:,.0f}'
)
It runs without errors, but it gives me two decimal places for all numbers.
Can anyone help me?