Date format issue with bar and line on same chart
Posted: Mon Jun 22, 2009 2:21 pm
I need have monthly report display by bar and line series on same chart.
The datasource return a datatable with 2 colums of YYYY-mm (monthly) and production loss for 12 months
I formate botom lable to
ch1.Axes.Bottom.Labels.DateTimeFormat = "MM/yyyy";
For bar chart if having
bar1.YValues.DataMember = dt.Columns["u_loss"].ToString();
bar1.LabelMember = dt.Columns["production_date"].ToString();
it will display format of MM/YYYY
but with line code of
fastLine1.XValues.DateTime = true;
int rowIndex = 0;
foreach (DataRow row in dt.Rows)
{
for (int colIndex = 1; colIndex < dt.Columns.Count; colIndex++)
{
fastLine1.Add(Convert.ToDateTime(row.ItemArray[0]), Convert.ToDouble(row[colIndex]));
}
}
rowIndex++;
The result will push bars all together, and line display not correctly either.
Bottom line, I would like to get help on display monthly data(1/2009, 120; 2/2009, 150, 3/2009, 162; ...) for line series
The datasource return a datatable with 2 colums of YYYY-mm (monthly) and production loss for 12 months
I formate botom lable to
ch1.Axes.Bottom.Labels.DateTimeFormat = "MM/yyyy";
For bar chart if having
bar1.YValues.DataMember = dt.Columns["u_loss"].ToString();
bar1.LabelMember = dt.Columns["production_date"].ToString();
it will display format of MM/YYYY
but with line code of
fastLine1.XValues.DateTime = true;
int rowIndex = 0;
foreach (DataRow row in dt.Rows)
{
for (int colIndex = 1; colIndex < dt.Columns.Count; colIndex++)
{
fastLine1.Add(Convert.ToDateTime(row.ItemArray[0]), Convert.ToDouble(row[colIndex]));
}
}
rowIndex++;
The result will push bars all together, and line display not correctly either.
Bottom line, I would like to get help on display monthly data(1/2009, 120; 2/2009, 150, 3/2009, 162; ...) for line series