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

Whole Numbers in Y Axis

1 Answer 28 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 21 Apr 2014, 06:32 PM
We have a RadCartesianChart utilizing a LinearAxis. It works great until there are few data points and it starts using decimals. The items that are graphed are whole units. 

Is there a way to instruct the LinearAxis to use integers only when it does its dynamic calculation?

I noticed this thread but it is from 2009.

http://www.telerik.com/forums/whole-numbers-not-decimal-in-y-axis

Michael

1 Answer, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 23 Apr 2014, 07:21 AM
Hello Michael,

The given forum post is for the old RadChart, and you are using the new ChartView control, so it really is not applicable.

Well, depending on the exact result you need, you can use one or two approaches. The easiest way to go is to set the LabelFormat property of the axis (say "N0"). This will ensure that the values are shown without the decimal point. However if before you had labels 1, 1.2. 1.4, 1.6 ... it would now show 1, 1, 1, 1 .. so perhaps this is not what you need.

May be you need to use the template selector capabilities of the axis (LabelTemplateSelector). In the SelectTemplate override you can check whether this is a whole number and if it is not, you can return an empty template (so the label would not be visible). Let us know how it goes.

Regards,
Petar Marchev
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Chart
Asked by
Michael
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or