Page 1 of 1
How to Display time variation between two CursorTools
Posted: Fri Sep 19, 2008 10:09 am
by 14049736
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.
Posted: Fri Sep 19, 2008 10:35 am
by narcis
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";
Posted: Fri Sep 19, 2008 11:20 am
by 14049736
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.
Posted: Fri Sep 19, 2008 11:46 am
by narcis
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);
Posted: Mon Sep 22, 2008 4:37 am
by 14049736
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.
Posted: Mon Sep 22, 2008 10:48 am
by narcis
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.