Date format issue with bar and line on same chart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Beige
Newbie
Newbie
Posts: 25
Joined: Wed Jun 28, 2006 12:00 am

Date format issue with bar and line on same chart

Post by Beige » 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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

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

Post by Narcís » Mon Jun 22, 2009 2:30 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Beige
Newbie
Newbie
Posts: 25
Joined: Wed Jun 28, 2006 12:00 am

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

Post by Beige » Mon Jun 22, 2009 3:55 pm

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

Beige
Newbie
Newbie
Posts: 25
Joined: Wed Jun 28, 2006 12:00 am

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

Post by Beige » Mon Jun 22, 2009 4:31 pm

I think i figure out

Post Reply