i am working in .Net Charts. i want to show date in X-Axis. For ex : if i select Last 52 Weeks, then i should show the chart for last 52 weeks, whereas those 52 weeks start date should be in x-axis. I am not having any idea, how to do this..I had tried with the code..
DateTime Frm = sessionManager.ChartViewPeriodFrom;
DateTime To = sessionManager.ChartViewPeriodTo;
double min = Frm.ToOADate();
double max = To.ToOADate();
Chart1.ChartAreas["ChartArea1"].AxisX.Minimum = min;
Chart1.ChartAreas["ChartArea1"].AxisX.Maximum = max;
Chart1.ChartAreas["ChartArea1"].AxisX.Interval = 7;
Here i am getting the Frm as "9/17/2011 12:00:00 AM" But, in the chart the minimum date starts from "9/21/2011 12:00:00 AM". How to fix this...
I had tried like this also..[ Edited Part ]
Chart1.Series["Series1"].XValueType = ChartValueType.Date;
Chart1.ChartAreas["ChartArea1"].AxisX.Minimum = (new DateTime(2011, 09, 17, 12, 00, 00)).ToOADate();
Chart1.ChartAreas["ChartArea1"].AxisX.Maximum = (new DateTime(2012, 09, 08, 12, 00, 00)).ToOADate();
Chart1.ChartAreas["ChartArea1"].AxisX.Interval = 7;
Chart1.ChartAreas["ChartArea1"].AxisX.IsMarginVisible = false;