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

How to add range of values in XAxis

0 Answers 53 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
annu
Top achievements
Rank 1
annu asked on 17 May 2011, 07:16 AM
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.

No answers yet. Maybe you can help?

Tags
Chart (Obsolete)
Asked by
annu
Top achievements
Rank 1
Share this question
or