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

6 posts, 0 answers
  1. Uros Mally
    Uros Mally avatar
    2 posts
    Member since:
    Sep 2009

    Posted 28 Sep 2009 Link to this post

    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
  2. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 01 Oct 2009 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Uros Mally
    Uros Mally avatar
    2 posts
    Member since:
    Sep 2009

    Posted 01 Oct 2009 Link to this post

    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
  5. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 05 Oct 2009 Link to this post

    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.
  6. Ishan Shah
    Ishan Shah avatar
    2 posts
    Member since:
    Feb 2010

    Posted 26 Feb 2010 Link to this post

    How I can display number in format like"2000" instead of "2.0K" in label on both Axis?

  7. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 03 Mar 2010 Link to this post

    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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready