Autosize y axis?

Thread is closed for posting
5 posts, 1 answers
  1. Jonathan
    Jonathan avatar
    92 posts
    Member since:
    Feb 2007

    Posted 06 Jan 2009 Link to this post

    Hi,

    I have a chart which can have a number of different series plotted with a numerical y axis and a datetime x axis.  The majority of the y axis points will be clustered around a certain value, say in the range 110-120.  I have set AutoScale to true on the y-axis, but it still starts at 0 and goes up to around 120.  Is there anything I can do to automatically limit the y axis to cover just the plotted values? i.e. start at 100, end at 120 for example.  I could find the min and max y value amongst all my series and set the MinValue and MaxValue properties but this is time consuming when I have large series of several hundred items.

    Thanks in advance.
  2. Answer
    Ves
    Admin
    Ves avatar
    2926 posts

    Posted 07 Jan 2009 Link to this post

    Hello Jonathan,

    There are two ways you can approach this:
    • Set IsZeroBased property of YAxis to false and let RadChart calculate the MinValue, MaxValue and Step for you. This way the axis will show only the relevant range according to the series data.
    • Set AutoScale property to false. Now you must provide MinValue, MaxValue and Step or use AddRange method to populate the Y axis. Virtually, it is the same effort as this method needs the values for these properties as parameters.
    As the second approach requires you to know the min and max value, I would suggest that you go for the first one. Hope this helps.
     
    Regards,
    Ves
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Jonathan
    Jonathan avatar
    92 posts
    Member since:
    Feb 2007

    Posted 07 Jan 2009 Link to this post

    Thanks, I had no idea that IsZeroBased property existed.  That has solved my problem.

    Thanks again.
  4. toby
    toby avatar
    1 posts
    Member since:
    Jan 2011

    Posted 30 Jan 2011 Link to this post

    Hello
    This thread was a really useful find. Could you please help me with an issue that continues from this. My chart has correctly scaled my Y axis with a maximum value 0f 6 howvever as i am using a spline chart the top curve of the spline goes off the top and is hidden. Can i override or add 1 to the maximum Y value so that the spline does not dissappear?

    Thanks
    Toby
  5. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 02 Feb 2011 Link to this post

    Hello Jonathan,

    I believe this article provides the answer -- YAixs.AxisMode property allows you to configure the Y axis as needed.

    Kind regards,
    Ves
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top