How to add range of values in XAxis

Thread is closed for posting
1 posts, 0 answers
  1. annu
    annu avatar
    7 posts
    Member since:
    May 2011

    Posted 17 May 2011 Link to this post

    I want to add the range of values in XAxis dynamically. For ex- if user selects range of date like start Date- 01/01/2011 and end Date- 5/14/2011 then in X-Axis it should display the month from 1-5 i.e Jan-May. But if the user selects Start Date-11/01/2010 and End Date-
    5/14/2011 then x-axis should display the Nov,Dec,Jan,Feb,Mar,Apr and May.
    So, here we need the two different range to be added in XAxis like:

     DateTime d1 =Convert.ToDateTime(txtStartDate.SelectedDate);
     DateTime d2 = Convert.ToDateTime(txtEndDate.SelectedDate);      
     if (d2.Month > d1.Month)
            {
                RadChart1.PlotArea.XAxis.AddRange(d1.Month, d2.Month , 1);
            }
            else
            {
                RadChart1.PlotArea.XAxis.AddRange(d1.Month, 12, 1);
                RadChart1.PlotArea.XAxis.AddRange(1, d2.Month, 1);
            }

    By the above code it is displaying in XAxis as Jan,Feb,Mar,Apr and May. It is not displaying the first range i.e Nov,Dec.
    Please help me out to solve this problem. It is very urgent.
Back to Top