Whole Numbers in Y Axis

2 posts, 0 answers
  1. Michael
    Michael avatar
    3 posts
    Member since:
    Oct 2012

    Posted 21 Apr 2014 Link to this post

    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.


  2. Petar Marchev
    Petar Marchev avatar
    968 posts

    Posted 23 Apr 2014 Link to this post

    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.

    Petar Marchev
    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.
  3. DevCraft R3 2016 release webinar banner
Back to Top