This is a migrated thread and some comments may be shown as answers.

Set/change chart`s culture info (number format)

5 Answers 190 Views
Chart (obsolete as of Q1 2013)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Uros Mally
Top achievements
Rank 1
Uros Mally asked on 28 Sep 2009, 07:55 AM
Hello,
where can I set/change culture info on chart? I would like to have properly formatted numbers for different languages/regions selected:
When CultureInfo is set to "sl-SI" separating characters should be '.' for group and ',' for decimal (number format example: 123.345.678,00) and if selected CultureInfo is "en-GB" separating characters should be ',' for group and '.' for decimal (number format example: 123,345,678.00)

Thanks,
Uros Mally

5 Answers, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 01 Oct 2009, 07:43 AM
Hi Uros,

The RadChart is culture-aware. To enable thousands separators, you need to specify the usage of number format, instead of general format for the labels:

public partial class Form1 : Form 
    public Form1() 
    { 
        Random r = new Random(); 
 
        InitializeComponent(); 
 
        // Uncomment to switch current culture: 
        // Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB"); 
 
        this.radChart1.PlotArea.YAxis.Appearance.CustomFormat = "N"
        this.radChart1.PlotArea.XAxis.Appearance.CustomFormat = "G"
 
        ChartSeries series = new ChartSeries(); 
        series.Type = ChartSeriesType.Bar; 
 
        series.DefaultLabelValue = "#Y{N}"
        for (int i = 0; i < 10; i++) 
            series.Items.Add(new ChartSeriesItem(Math.Round(r.NextDouble() * 10000, 2))); 
 
        this.radChart1.Series.Add(series); 
    } 

Let me know if you need further assistance.

Best wishes,
Evtim
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Uros Mally
Top achievements
Rank 1
answered on 01 Oct 2009, 08:27 AM
Hi,
Thank you for your answer, the only problem was that I set new culture info only to the Thread.CurrentThread.CurrentUICulture and not Thread.CurrentThread.CurrentCulture .
I have another question:
I would like to display numbers only with group separator (without decimal). Currently I added "#,#" in my custom format property and it works just fine (it is not realy a problem), but I would like to know if there is any other way to specify that format?

Thank you for your assistance,
Uros Mally
0
Dwight
Telerik team
answered on 05 Oct 2009, 06:31 AM
Hello Uros,

Using the #,# is the correct way of specifying the format you need.

All the best,
Evtim
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ishan Shah
Top achievements
Rank 1
answered on 26 Feb 2010, 01:34 PM
How I can display number in format like"2000" instead of "2.0K" in label on both Axis?

0
Ves
Telerik team
answered on 03 Mar 2010, 07:43 AM
Hi Ishan Shah,

I have answered your question in the other forum thread.

Regards,
Ves
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Chart (obsolete as of Q1 2013)
Asked by
Uros Mally
Top achievements
Rank 1
Answers by
Dwight
Telerik team
Uros Mally
Top achievements
Rank 1
Ishan Shah
Top achievements
Rank 1
Ves
Telerik team
Share this question
or