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

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

4 Answers 55 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Masha
Top achievements
Rank 1
Masha asked on 21 Apr 2010, 05:22 PM
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.

4 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 26 Apr 2010, 12:49 PM
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.
0
Mayra
Top achievements
Rank 1
answered on 15 Nov 2011, 09:14 PM
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
0
Ves
Telerik team
answered on 17 Nov 2011, 04:25 PM
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 >>

0
Mayra
Top achievements
Rank 1
answered on 17 Nov 2011, 05:58 PM
Thanks for the clarification. 
Tags
Chart
Asked by
Masha
Top achievements
Rank 1
Answers by
Ves
Telerik team
Mayra
Top achievements
Rank 1
Share this question
or