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

Date on x-axis with 1 month step

1 Answer 645 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
rajesh
Top achievements
Rank 1
rajesh asked on 04 Jan 2012, 10:30 PM
I am trying to plot a chart where datapoint ( x, y ) are as-
(datetime, number)

datetime is always in the format of "01-Month-Year"  i.e.  date part is always first of month
While adding X-axis range I am trying to use-

RadChart.PlotArea.XAxis.AddRange(dtBegin.ToOADate(), dtEnd.ToOADate(), 31);

 

RadChart.PlotArea.XAxis.LayoutMode = Telerik.Charting.Styles.ChartAxisLayoutMode.Inside;
RadChart.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.ShortDate;
RadChart.PlotArea.XAxis.Appearance.CustomFormat = "dd MMM yyyy";
RadChart.PlotArea.XAxis.AddRange(dtBegin.ToOADate(), dtEnd.ToOADate(), 31);


The problem with above code  is that steps of 31 means that  since not all month has 31 days we will end up with x-axis data point which will not  be in 01-Month-Year format.

what I want on x-axis is like this

01-Nov-2010
01-Dec-2010
01-Jan-2011
01-Feb-2011
01-Mar-2011
01-Apr-2011
01-May-2011
01-Jun-2011
01-Jul-2011
01-Aug-2011
01-Sep-2011
01-Oct-2011
01-Nov-2011
01-Dec-2011
01-Jan-2012
01-Feb-2012
01-Mar-2012
01-Apr-2012
01-May-2012
01-Jun-2012
01-Jul-2012
01-Aug-2012
01-Sep-2012
01-Oct-2012

 what I get is something as shown in attached image.

How can I add date alone x-axis with steps of 1 month.


1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 05 Jan 2012, 06:33 PM
Rajesh:

I do not believe it's possible to accomplish x-axis data points to display in the format you require. There's a suggested workaround in the Adding 1 Month Intervals to Chart X-Axis Range forum thread, if you've not already seen it.

Hope this helps.
Tags
Chart (Obsolete)
Asked by
rajesh
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or