✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Localize Tickformat: 'k' to 'tsd' and 'M' to 'Mio'

Hello, I need some help with tickformat-configuration.

For example, in the y-axis, the TICKS of big values are formatted like this:

750k
500k
250k

or

3M
2M
1M

I want to localize that, in german it should be

750tsd
500tsd
250tsd

or

3Mio
2Mio
1Mio


Any ideas how to do that? Google wasn’t helpfull for me.

Thanks
Salvatore

Hi @seckel

Take a look at this discussion https://community.plotly.com/t/how-to-change-unit-in-vertical-text/34731, to learn how to use yaxis tickvals and ticktext to display country specific big numbers. FOr their use with plotly.js see here https://plot.ly/javascript/tick-formatting/.

@empet Thank you. Now I have a working solution.

I needed to do some math, so that it works with small values [0-999]
and with bigger values [1000 - 100.000.000] (“tsd”, “Mio”)

If values bigger than one billion are used, I just use the default “ticks”, because there is no corresponding abbreviation for “Billion” in german :open_mouth:


Now, the only thing what displeases me, is that I have a fixed-amount of ticks for all screen-sizes.


Before this solution, I also tried to use the Plotly-JS Localisation-Files:
(https://github.com/plotly/plotly.js/blob/master/dist/README.md#to-include-localization)
but that did not help me.

I would suggest that Plotly-JS should be able to “translate” the “k” (kilo) and “M” (million) with these translationfiles! Then I wouldn’t need to write “tickvals” and “ticktext” when I just want to translate a suffix…?!

Best Regards
Salvatore

@seckel

You may want to propose such an enhancement here https://github.com/plotly/plotly.js/issues.

I will have a look at it :beers: