seckel
March 16, 2020, 11:17am
1
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
empet
March 16, 2020, 4:55pm
2
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/ .
seckel
March 17, 2020, 12:59pm
3
@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
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
empet
March 17, 2020, 1:18pm
4
@seckel
You may want to propose such an enhancement here https://github.com/plotly/plotly.js/issues .