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

Latest Max Value

2 Answers 48 Views
Chart
This is a migrated thread and some comments may be shown as answers.
rahul
Top achievements
Rank 1
rahul asked on 30 Nov 2011, 03:44 PM
I have the requirement to generate the Charts Y Axis manually on some conditions. Code below:

 

 

double maxValue = myRadChart.DefaultView.ChartArea.AxisY.ActualMaxValue;

 

 

 

myRadChart.DefaultView.ChartArea.AxisY.AutoRange = true;

 

 

 

if (maxValue <= avg_weekly_budget)

 

{

 

 

myRadChart.DefaultView.ChartArea.AxisY.AutoRange = false;

 

 

 

myRadChart.DefaultView.ChartArea.AxisY.MinValue = 0;

 

 

 

myRadChart.DefaultView.ChartArea.AxisY.MaxValue = Math.Floor(avg_weekly_budget);

 

 

 

myRadChart.DefaultView.ChartArea.AxisY.Step = avg_weekly_budget/10;

 

}
I'm binding the chart before above code with my data and want to retrieve the MaxValue from it, If the MaxValue is greater than some value, i want to draw thw chart manually..
This ActualMaxValue does not always give me the latest value. It seems like charts is getting created on another thread. However if I put the breakpoint, I could see latest value always, probably because of the delay. 
How can I make sure that value I have got is the latest one.
I can always get the max value from my data, but I don't want to dependent on it. 

Thanks,
Rahul 

 

2 Answers, 1 is accepted

Sort by
0
rahul
Top achievements
Rank 1
answered on 02 Dec 2011, 07:59 AM
Hi Any update for this from telerik team?
0
Ves
Telerik team
answered on 05 Dec 2011, 12:29 PM
Hi Rahul,

The chart is created in the same thread, but the axis range is calculated on several iterations and it depends on the available room. This is done in order to ensure that the Y axis is not flooded with ticks when only small space is available, but at the same time there are enough ticks in a large space. My suggestion here would be to wire the RangeChanged event of AxisY and perform your calculations there. The ActualMaxValue property will hold the correct value. Notice, that according the above explanation, this event might be fired more than once.

Best regards,
Ves
the Telerik team

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

Tags
Chart
Asked by
rahul
Top achievements
Rank 1
Answers by
rahul
Top achievements
Rank 1
Ves
Telerik team
Share this question
or