So I'm binding a list of custom business objects to a rad chart, for this instance, an overview of monthly revenue for a year. The dates that I'm setting for the X-axis Label aren't rendered as what I've set them at all.
Here's my basic code, you can see that get a list of monthLedger objects for a given year. The monthLedger object has different properties, but the main ones for this scenario are monthLedger.Full_date and monthLedger.Revenue_Amount.
Here is the data that I would get in the list for 2011 (Full_Date || Revenue_Amount):
What I expect to get is a nice chart with 12 months, but 13 columns end up being graphed and the dates labeled are not at all the same as the ones I've converted to OLE Automation Date.
I've attached a screenshot of the graphic result.
What am I doing wrong?
Here's my basic code, you can see that get a list of monthLedger objects for a given year. The monthLedger object has different properties, but the main ones for this scenario are monthLedger.Full_date and monthLedger.Revenue_Amount.
List<monthLedger> year = getYearRevenueByMonth(2011);
DataSeries ser =
new
DataSeries();
foreach
(monthLedger month
in
year)
{
ser.Add(
new
DataPoint { YValue = Convert.ToDouble(month .Revenue_Amount), Label = month .Revenue_Amount.ToString(
"0.00###"
), XValue = month.Full_Date.ToOADate()});
}
radChart1.DefaultView.ChartArea.AxisX.IsDateTime =
true
;
radChart1.DefaultView.ChartArea.AxisX.AutoRange =
true
;
radChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat =
"dd-MMM"
;
radChart1.DefaultView.ChartArea.DataSeries.Add(ser);
Here is the data that I would get in the list for 2011 (Full_Date || Revenue_Amount):
- {01/01/2011 12:00:00 AM} || 0.00
- {01/02/2011 12:00:00 AM} || 0.00
- {01/03/2011 12:00:00 AM} || 0.00
- {01/04/2011 12:00:00 AM} || 0.00
- {01/05/2011 12:00:00 AM} || 0.00
- {01/06/2011 12:00:00 AM} || 0.00
- {01/07/2011 12:00:00 AM} || 0.00
- {01/08/2011 12:00:00 AM} || 0.00
- {01/09/2011 12:00:00 AM} || 0.00
- {01/10/2011 12:00:00 AM} || 0.00
- {01/11/2011 12:00:00 AM} || 246.50
- {01/12/2011 12:00:00 AM} || 311.60
What I expect to get is a nice chart with 12 months, but 13 columns end up being graphed and the dates labeled are not at all the same as the ones I've converted to OLE Automation Date.
I've attached a screenshot of the graphic result.
What am I doing wrong?