Page 1 of 1

Date format issue with bar and line on same chart

Posted: Mon Jun 22, 2009 2:21 pm
by 9641714
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

Re: Date format issue with bar and line on same chart

Posted: Mon Jun 22, 2009 2:30 pm
by narcis
Hi Beige,

Can you please arrange a simple example project we can run "as-is" to reproduce the problem here? You can create a simble run-time datasource as in the example here:

http://www.teechart.net/support/viewtopic.php?t=8206

Thanks in advance.

Re: Date format issue with bar and line on same chart

Posted: Mon Jun 22, 2009 3:55 pm
by 9641714
my problem is more on for Xvalue in month format "MM/YYYY", does it treat as date formate or string format. If treat like a date format, line will try to divid X evenly by 30 days, so it shows 6/2009, 7/2009, 7/2009, the second 7/2009 actually is for day 7/31/2009. If it treat as string, how the sorting will be?
Thanks,
Beige

Re: Date format issue with bar and line on same chart

Posted: Mon Jun 22, 2009 4:31 pm
by 9641714
I think i figure out