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

How to format the axis values with commas in a telerik reporting chart

3 Answers 666 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
srilal
Top achievements
Rank 1
srilal asked on 07 Sep 2011, 04:35 PM
Hello,

I am developing dashboard reports using Telerik Q2 2011 tools. My question here is how to format numbers with commas (,) for easy reading in the axis appearance properties.

When I use 'Number' value format it shows the decimal places and that is ok for the actual decimal values (see Y-axis2 below image) but I also need to format with commas without decimal positions. E.G. 1,000.

Please see the Y-axis below and I need to use commas to format it. Please help. Thanks in advance.


Srilal

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 12 Sep 2011, 11:39 AM
Hello Srilal,

To be able to set custom format for the axis label you should use the ValueFormat property as it  automatically formats values as Currency, Scientific, General, Number, Percent, ShortDate, ShortTime, LongDate, LongTime or None. Then you can set Custom Format Strings (http://msdn.microsoft.com/en-us/library/0c899ak8.aspx) to the property CustomFormat.
Here is how to format YAxis labels:

Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
chart1.PlotArea.YAxis.Appearance.ValueFormat = Telerik.Reporting.Charting.Styles.ChartValueFormat.Number;
chart1.PlotArea.YAxis.Appearance.CustomFormat = "#,#";


All the best,
Steve
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
srilal
Top achievements
Rank 1
answered on 12 Sep 2011, 03:25 PM
Hello Steve,

Thanks for the reply and the help.

I used 'Value format: Number' and 'Custom format: "#,#", CultureInfo.InvariantCulture'. It looks good however, I still need to get rid of the decimal places of the values. This axis shows the 'number of claims' and displaying the number with decimal places would not be right. Please see the chart below.

Is there anything else I can do to drop the decimal places. Thanks.

Srilal

 

0
IvanDT
Telerik team
answered on 15 Sep 2011, 12:37 PM
Hello Srilal,

You have to set the ValueFormat property to None or not set it at all.

Kind regards,
IvanDT
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
General Discussions
Asked by
srilal
Top achievements
Rank 1
Answers by
Steve
Telerik team
srilal
Top achievements
Rank 1
IvanDT
Telerik team
Share this question
or