Latest Max Value

3 posts, 0 answers
  1. rahul
    rahul avatar
    25 posts
    Member since:
    Jan 2011

    Posted 30 Nov 2011 Link to this post

    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. rahul
    rahul avatar
    25 posts
    Member since:
    Jan 2011

    Posted 02 Dec 2011 Link to this post

    Hi Any update for this from telerik team?
  3. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 05 Dec 2011 Link to this post

    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 >>

Back to Top