How to Display time variation between two CursorTools

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
vijay
Newbie
Newbie
Posts: 42
Joined: Thu Jul 31, 2008 12:00 am
Contact:

How to Display time variation between two CursorTools

Post by vijay » Fri Sep 19, 2008 10:09 am

Hello,

Is there any way to get the time span between two Vertical CursorTools.
Do do i need to make use of the DrawlineTool for such kind of support.


Thanks,
Vijaylal.

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

Post by Narcís » Fri Sep 19, 2008 10:35 am

Hi Vijaylal,

Yes, you can do something like this:

Code: Select all

			TimeSpan timeDifference = DateTime.FromOADate(cursor1.XValue) - DateTime.FromOADate(cursor2.XValue);
			int total = (timeDifference.Seconds * 1000) + timeDifference.Milliseconds;

			label1.Text = "Difference: " + total.ToString() + " ms";
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

vijay
Newbie
Newbie
Posts: 42
Joined: Thu Jul 31, 2008 12:00 am
Contact:

Post by vijay » Fri Sep 19, 2008 11:20 am

Hello Narcís, thanks for your quick response.

Actually what required is to display that time difference by drawing a line between those CursorTools.

like this.., |-----------Value--------|.

Thanks,
Vijaylal.

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

Post by Narcís » Fri Sep 19, 2008 11:46 am

Hi Vijaylal,

You can use a line series for that, for example:

Code: Select all

			Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);

			double midPoint = tChart1.Axes.Left.Minimum + (tChart1.Axes.Left.Maximum - tChart1.Axes.Left.Minimum) / 2;
			line1.Add(cursor1.XValue, midPoint);
			line1.Add(cursor2.XValue, midPoint);
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

vijay
Newbie
Newbie
Posts: 42
Joined: Thu Jul 31, 2008 12:00 am
Contact:

Post by vijay » Mon Sep 22, 2008 4:37 am

Thanks Narcís.
This works fine. But i found some difficulties in using a line between two vertical cursorTools.
1.I cannot reposition it.
2.I Cant apply Dash style etc...

Is there any way to place a horizontal CursorTool between those vertical cursortools ?. So that i could drag and reposition it to display 'y' value variations.


Thanks,
Vijay.

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

Post by Narcís » Mon Sep 22, 2008 10:48 am

Hi Vijay,
1.I cannot reposition it.
You could repopulate line series every time cursor's Change event is fired. However, I recommend you to do something as in the All Features\Welcome !\Chart styles\Standard\Line(Strip)\Interpolating line series example at the features demo available at TeeChar'ts program group. Instead of drawing circles you could draw a line from one cursor position to the other.
2.I Cant apply Dash style etc...
Yes, this possible with line series:

Code: Select all

			line1.LinePen.Style = System.Drawing.Drawing2D.DashStyle.Dash;
Anyway, you can do the same with canvas' pen.
Is there any way to place a horizontal CursorTool between those vertical cursortools ?. So that i could drag and reposition it to display 'y' value variations.
Yes, you could do that following the same principles in the example I pointed you.
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

Post Reply