Strech bars on chart to fill chart area (AutoRange = false)

5 posts, 0 answers
  1. Masha
    Masha avatar
    5 posts
    Member since:
    Apr 2010

    Posted 21 Apr 2010 Link to this post

    Hi,

    I'm trying to fill the entire area of the chart with bars by doing the following:

    <telerikCharting:AxisY Title="Cost" AutoRange="False" MinValue="0" MaxValue="{Binding MaxValue}"  Step="{Binding Step}">

    The MaxValue can be a wide range of values. The Step can vary as well based on the MaxValue. The chart doing the calculations of the Step automatically if the AutoRange is set to True.
    Can you please provide the calculation method for Step value so the stretching of the bars can be achieved dynamically?

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

    Posted 26 Apr 2010 Link to this post

    Hi Masha,

    The step calculations are actually part of a complex code block, which also calculates the min and max value and takes into account different parameters including the chart size. However, you can easily calculate the Step value you need, given that you already have the min and max value. Just divide the difference by the number of steps you need:

    step = (max - min) / 5;

    I should also mention, that  with AutoRange=true, by default RadChart adds an additional step on the top of AxisY, but this can be disabled. The AxisY.ExtendDirection property controls this behavior. Set it to AxisExtendDirection.None and the axis will be auto-calculated to cover the data with no extension. You can also set the IsZeroBased property to true, so that the Y axis always starts from zero.

    Kind regards,
    Ves
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Mayra
    Mayra avatar
    18 posts
    Member since:
    Oct 2011

    Posted 15 Nov 2011 Link to this post

    Would you please tell me if the ExtendDirection property works when the autoRange property is set to false and I am calculating the max and minimum?

    Thanks you in advance for the help and I look forward to hear from you

    Regards
  4. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 17 Nov 2011 Link to this post

    Hello Mayra,

    ExtendDirection property is designed to allow the axis to extend its range by a single step while keeping the automatic range calculation. When AutoRange is set to false, it's developers responsibility to provide MinValue, MaxValue and Step, so all you need to do in this case is to increase the MaxValue by a single step and/or decrease the MinValue in similar manner. That said, ExtendDirection is ignored when automatic range calculation is turned off.

    Best regards,
    Ves
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Mayra
    Mayra avatar
    18 posts
    Member since:
    Oct 2011

    Posted 17 Nov 2011 Link to this post

    Thanks for the clarification. 
Back to Top