Page 1 of 1

Unable to keep vertical asTeeCursor object stationary

Posted: Wed Apr 12, 2006 8:32 pm
by 9527388
I am using TeeChart ActiveX (version 7.0.0.4) in an HTML page and am using the asTeeCursor object to provide some vertical cursors. I am able to add then number of vertical cursors as well a move them thru drag/drop of the cursor object. I am using a basic trend with X-Y axis, where X is the time axis and Y is the value axis. Everything behaves as expected until the the data is updated. Since this is a time based trace, when the update occurs, the time axis is shifted as appropriate, and the trace redrawn with the new data. What I would like to be able to provide is a static vertical cursor; however, the behavior that I see is that the vertical cursor is automatically adjusted when the time axis is shifted. Is there anyway to create a static vertical cursor such that when the time axis is shifted, the vertical cursor remains in the same screen postion?

Here is the code that I am using to create the cursor as well as peform the manual positioning.

Code: Select all


'/// add additional cursor objects  (in Window_OnLoad)
		For i = 0 To g_numCursors 
			TChart1.Tools.Add tcCursor
			With TChart1.Tools.Items(TChart1.Tools.Count - 1).asTeeCursor
				.FollowMouse = False
				.Style = g_cssVertical
				.Pen.Color = vbRED
				.Pen.Style = g_psClear
				.Pen.Width = g_CursorWidth
				'.Series = 0
			End With
		
		Next 


'/// position cursor (in TChart1_OnMouseDown)
    If Shift = g_ssShift Then
        For i = 1 To g_numCursors'TChart1.Tools.Count'g_numCursors
            With TChart1.Tools.Items(i).asTeeCursor
               If .Pen.Style = g_psClear Then
                    .Series = 0
                    .FollowMouse = False
                    .Style = g_cssVertical
                    .Pen.Color = vbRED
                    .Pen.Style = g_psDash
                    .Pen.Width = g_CursorWidth
                    .XVal = TChart1.Series(0).XScreenToValue(X)
                    cursorArrayXPos(i) = X
                    Exit For
                End If
            End With
        Next 
Thanks,
Scott

Posted: Tue Apr 18, 2006 9:43 am
by Pep
Hi Scott,

one way to keep the Cursor at the same pos could be using similar code to the following :

Code: Select all

Private Sub Command3_Click()
With tChart1
.Series(0).FillSampleValues (Rnd * 5)
.Environment.InternalRepaint
.Tools.Items(0).asTeeCursor.XVal = .Axis.Bottom.Minimum + ((.Axis.Bottom.Maximum - .Axis.Bottom.Minimum) / 2)
End with
End Sub