using datetime with colorline tool

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
LordWhorfin
Newbie
Newbie
Posts: 24
Joined: Wed Feb 22, 2006 12:00 am
Location: Flagstaff, Arizona, USA

using datetime with colorline tool

Post by LordWhorfin » Tue Sep 11, 2007 9:33 pm

Hello,

I'm trying to draw a colored line at a specific point on the x-axis of my chart using the colorline tool. The x-axis is date and time, which is giving me problems. I think this should work..


Line 82: colorLine1.Axis = WebChart1.Chart.Axes.Bottom
Line 83: colorLine1.Pen.Color = Drawing.Color.Yellow
Line 84: colorLine1.Value = "8/21/2007 11:14:00 AM"
Line 85:

But I get the following error..

Exception Details: System.FormatException: Input string was not in a correct format.


Can you tell me what I'm doing wrong?

cheers, Paul

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

Post by Narcís » Wed Sep 12, 2007 10:05 am

Hi LordWhorfin,

You should use something like this:

Code: Select all

			colorLine1.Value = DateTime.Parse("8/21/2007 11:14:00 AM");
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

LordWhorfin
Newbie
Newbie
Posts: 24
Joined: Wed Feb 22, 2006 12:00 am
Location: Flagstaff, Arizona, USA

Post by LordWhorfin » Wed Sep 12, 2007 2:12 pm

narcis wrote:Hi LordWhorfin,

You should use something like this:

Code: Select all

			colorLine1.Value = DateTime.Parse("8/21/2007 11:14:00 AM");
That generates an error..

Conversion from 'Date' to 'Double' requires calling the 'Date.YoOADate' method.

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

Post by Narcís » Wed Sep 12, 2007 2:23 pm

HI LordWhorfin,

Sorry, what about this then?

Code: Select all

         colorLine1.Value = DateTime.Parse("8/21/2007 11:14:00 AM").ToOADate();
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

LordWhorfin
Newbie
Newbie
Posts: 24
Joined: Wed Feb 22, 2006 12:00 am
Location: Flagstaff, Arizona, USA

Post by LordWhorfin » Wed Sep 12, 2007 4:29 pm

narcis wrote:HI LordWhorfin,

Sorry, what about this then?

Code: Select all

         colorLine1.Value = DateTime.Parse("8/21/2007 11:14:00 AM").ToOADate();
That did it, thank you. Paul

Post Reply