1 Attachment(s)
How to change the display format of numbers on axis?
I'm trying to show a range -32768.0, 32767.0 on right Y axis:
Code:
setAxisScale(yRight, -32768.0, 32767.0);
But if the value is 10000, it will displayed as 10,000. In fact I don't want the comma to be shown. How to change the display format? It seems there's no such an interface.
Attachment 7326
Re: How to change the display format of numbers on axis?
Quote:
Originally Posted by
wang9658
In fact I don't want the comma to be shown. How to change the display format?
How numbers are converted to strings depends on the locale of the runtime environment. So this is something that depends on the preferences of the user of the application - not on the taste of the application developer. That's why you shouldn't hardcode something when your application is intended to run in different countries ( or at least by users with different nationalities ).
But in situations, where you want to ignore the environment you can modify the locale ( see QLocale or google for i18n ). This has an effect on many C-library functions ( like sprinf() ) and for QString conversions as well. If you want to manipulate the displayed labels in a way that has nothing to do with i18n you can overload and reimplement QwtScaleDraw::label().
HTH,
Uwe
Re: How to change the display format of numbers on axis?
Thank you for your reply. You let me see sth should depend on the runtime enviroment but not the developper. So I will do as it is. Very thanks again.
Kevin