Page 1 of 1

Changing thousand separator at run time? Localization?

Posted: Sat Jul 21, 2007 3:03 pm
by 6926840
Hi
We are using TeeChart (v5) to draw chart and then send the images to web pages. We want to use user specific preferences for formatting to print the numbers (for example: US 123,456,789.0 while French
123 456 789,0
Ideally I would like to pass MS LCID and the number and just be done with it.
Or I'll be happy if I can specify the thousand separator to use for number format (for e.g. ###,##0.0 does the job for US, but the separator is always a ,

any ideas?

Posted: Mon Jul 23, 2007 7:39 am
by yeray
Hi rajeev,

You can take a look at your Windows Control Panel -> Regional and Language Options go to Customize and try modifying your decimal symbol and your digit grouping symbol.

If this doesn't solve your problem, let us know.

I want to programmatically set formatting ...

Posted: Wed Jul 25, 2007 11:28 am
by 6926840
Thanks for the suggestion, but I do not think I was clear enough.

Basically the situation is:
We are using Teechart behind the scenes to generate graphs and serve it over the web. Multiple users could be coming in with each of their preferences for formatting options - so based upon the option i want to change the thousand separator/decimal separator used by teechart for creating that particular graph. Effectively we will have two formatting: US style (123,456.78) or the French/Mainland European (123 456,78) - but do want to change between the two

Any suggestions?

thanks
rajeev

Posted: Fri Jul 27, 2007 3:18 pm
by Pep
Hi Rajeev,

In terms of displaying numbers in a TeeChart, what is actually displayed in will depend on the locale defined in the Windows Regional Options, more specifically in what is set in the Decimal Separator and Digit Grouping Symbol under "Numbers". For example, I run a US version of Windows System with the local set as "Spanish" (which uses the Number format used by Spanish and German) and when I run the following VB code:
Private Sub Form_Load()
With TChart1
.AddSeries scBar
.Axis.Bottom.Labels.Angle = 90
For i = 37000 To 37028
.Series(0).AddXY i, Rnd * 100, "", clTeeColor
Next i
End With
End Sub

The numbers on the bottom axis appear as "37.012", "37.014" etc. Opening "Regional Settings" and changing the locale in "General", the default locale in "Input Locales" and the locale in the toolbar to English (United Kingdom) and running the code above gives me "37,012", "37.014" etc.on the bottom axis without any need for further programming.

Number formatting

Posted: Tue Aug 07, 2007 6:18 pm
by 6926840
So is there a way for me to change the Locale setting programmatically (we are using C++, so have access to Wn32 apis) before TeeChart starts drawing the graph? Here is what I want to do (in pseudo code)

function drawGraph(StylePrefEnum stylePref, int graphId) {
if (stylePref == EUROPEAN) {
do something
}
else {
do somthing
}

..
data = getDataForGraph(graphId)
..
cleanUpCurrentTeeChartObject()
..
createSeriesAndAddPoints(data)
teechart.redraw()
..
teechart.export() ...

}

Posted: Wed Aug 08, 2007 8:57 am
by narcis
Hi rajeev,

I'm afraid this is not a TeeChart related question and we are not able to help you on this. However I'm sure you'll find lots of information on how to achieve what you request Googling a little bit.

Re: Changing thousand separator at run time? Localization?

Posted: Fri Apr 15, 2011 8:53 am
by 16658606
Hi,
We are using Teechart2010. Does TeeChart2010 stick to the Regional Settings or is it now possible to change the decimal symbol programmatically?

thanks
Jürgen

Re: Changing thousand separator at run time? Localization?

Posted: Fri Apr 15, 2011 10:28 am
by yeray
Hello Arieh,

Take a look at the following example:
http://www.teechart.net/support/viewtop ... 387#p36387