Page 1 of 1

Teechart fastline tooltips?

Posted: Thu Jun 05, 2008 10:21 am
by 9529928
Hi,

I'm wondering whether it's possible to add some sort of tooltip to each series' fastline in a teechart (version 7 ActiveX). We display up to 30 lines in one chart, which sometimes makes it a bit blurry to read line names and values. Therefore it would be easy to have each line's name and value displayed at the point where the mouse cursor hovers over it.
Is this included in TeeChart Pro v7? If so, how do I program it?

Thanks a lot in advance.
Tom.

ps. I'm pretty much of a programming newbie... :oops:

Posted: Thu Jun 05, 2008 11:01 am
by narcis
Hi tsoffers,

Yes, there's MarksTips tool for that. You can use the tool for displaying the hints and associated events to customize the text on them.

You'll find MarkTips tool examples at All Features\Welcome!\Tools\Marks Tip in the features demo. You may also be interested in having a look at Tutorial 19 - The TeeChart Tool Collection. Tutorials and demo are available at TeeChart's program group.

An example of what you request would be something like this:

Code: Select all

Dim SeriesIndex As Integer

Private Sub Form_Load()
    For i = 0 To 4
        TChart1.AddSeries scLine
        TChart1.Series(i).FillSampleValues 10
    Next
    
    SeriesIndex = -1
    
    TChart1.Tools.Add tcMarksTip
End Sub

Private Sub TChart1_OnMarkTipToolGetText(ByVal Tool As Long, Text As String)
    If SeriesIndex <> -1 Then
        Text = TChart1.Series(SeriesIndex).Name & ": " & Text
    End If
End Sub

Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    For i = 0 To TChart1.SeriesCount - 1
        If TChart1.Series(i).Clicked(X, Y) <> -1 Then
            SeriesIndex = i
        End If
    Next
End Sub

Posted: Fri Jun 06, 2008 12:00 pm
by 9529928
Thanks a lot, and it seems to work too. The only thing that I can't get to happen, is this:

I'd like it to show the series' name as well. The value that's displayed is okay, but it always adds the name of the first series, and not the one the cursor hovers over.

Code: Select all

Private Sub TChart1_OnMarkTipToolGetText(ByVal Tool As Long, Text As String)
    If SeriesIndex <> -1 Then
        Text = TChart1.Series(SeriesIndex).Name & ": " & Text
    End If
End Sub
So it's always the TChart1.Series(SeriesIndex).name of the first series that is filled in, and when I put a stop, the 'SeriesIndex' variable returns an 'Empty' value.
How can I get the SeriesIndex filled in with the series index of the series the cursor is hovering over?

Thanks again!

Posted: Fri Jun 06, 2008 1:14 pm
by narcis
Hi tsoffers,

It works fine for me here using exactly the same code as I posted in my previous reply and using TeeChart Pro v8.0.0.3 ActiveX. Are you using the very same code? Which TeeChart version are you using?

Thanks in advance.

Posted: Mon Jun 09, 2008 8:08 am
by 9529928
OK, I got it to work now. I forgot to declare the SeriesIndex variable.

Thanks!