YAxis formatting

Thread is closed for posting
2 posts, 0 answers
  1. George
    George avatar
    7 posts
    Member since:
    Sep 2011

    Posted 07 May 2012 Link to this post

    I'm trying to format numbers in the Y axis to 1 decimal.  If I do:
     RadChart1.PlotArea.YAxis.Appearance.ValueFormat = ChartValueFormat.None;
     RadChart1.PlotArea.YAxis.Appearance.CustomFormat = "##.0";
    it works(it shows a label with a value of 39.00 as 39.0)

     If I do:
     RadChart1.PlotArea.YAxis.Appearance.ValueFormat = ChartValueFormat.Number;
    RadChart1.PlotArea.YAxis.Appearance.CustomFormat = "##.0";
    it doesn't work (it shows a label with a value of 39.00 as 39.00)

    but in the X axis this special custom format works fine (2 lines with the right custom format):
     RadChart1.PlotArea.YAxis.Appearance.ValueFormat = ChartValueFormat.LongDate;
    RadChart1.PlotArea.YAxis.Appearance.CustomFormat = "HH:mm\nM/dd";
    is the ChartvalueFormat.None required for CustomFormats in the Y axis?

  2. Ves
    Ves avatar
    2916 posts

    Posted 10 May 2012 Link to this post

    Hi George,

    Both X and Y axes work the same way. When ValueFormat is numeric (i.e. one of Currency, Scientific, General, Number, Percent) CustomFormat is ignored. You can use None to apply custom numeric format. However, when ValueFormat is DateTime-related, CustomFormat is respected and this allows you to specify your own formatting for DateTime values.

    Best regards,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top