Page 1 of 1

scPoint tooltips

Posted: Thu Jan 11, 2007 10:30 am
by 9530819
I have a base series which is a normal scLine.

To indicate events at certain points in time I add a scPoint series which then plots squares at the relevant point in time on top of the base line.

I have custom tooltips so I use the OnMouseEnterSeries to determine which series the mouse is on then call the correct tooltip.

In this scenario it is difficult to get the OnMouseEnterSeries event fired for the scPoint series. Even when the cursor is visually inside the point (say a square) the control sees it as entering the base line series.

Is there an event, or some way to check if the cursor is inside a point?

Thanks

Posted: Thu Jan 11, 2007 4:55 pm
by narcis
Hi Rossmc,

Yes, you can do something as in the example below which uses the OnMouseMove event and series Clicked method.

Code: Select all

Private Sub Form_Load()
    TChart1.AddSeries scLine
    TChart1.AddSeries scPoint
    
    For i = 0 To 10
        YVal = Rnd
    
        TChart1.Series(0).Add YVal, "", clTeeColor
        TChart1.Series(1).Add YVal, "", clTeeColor
    Next
End Sub

Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    Index = TChart1.Series(1).Clicked(X, Y)
    
    If (Index <> -1) Then
        TChart1.Header.Text.Clear
        TChart1.Header.Text.Add CStr(Index)
    Else
        TChart1.Header.Text.Clear
        TChart1.Header.Text.Add "No point"
    End If
End Sub