Using chart and tooltip

1.3k views Asked by At

I'm in internship for a month and i'm using Chart and tooltip :

Dim serie As System.Windows.Forms.DataVisualization.Charting.Series = mydata.getSeries()
For i = 0 To serie.Points.Count - 1
    For Each ser As System.Windows.Forms.DataVisualization.Charting.Series In Chart1.Series
                        ser.Points.Add(serie.Points(i))
       Next
Next
'Chart1.Series(1).LabelToolTip = "why" 

Points I add to ser has tooltip but when i launch the app, i can't see tooltip. If i uncomment the last line, i can see the tooltip. I can put anything to replace "why" but i must put something or i couldn't see tooltip of point. So atm my code works but i dont understand why I need this line

Chart1.Series(1).LabelToolTip = "why"

I would like to understand my code ^^

Thanks and sorry for my bad english

1

There are 1 answers

1
Feign On BEST ANSWER

I think I understand your question now.

The reason why you're not seeing your tooltips is because each point has to be given a value for its LabelToolTip property.

So here's what you could do:

Dim serie As System.Windows.Forms.DataVisualization.Charting.Series = mydata.getSeries()
    For i = 0 To serie.Points.Count - 1
        For Each ser As System.Windows.Forms.DataVisualization.Charting.Series In Chart1.Series
                            serie.Points(i).LabelToolTip = "What ever you want"
                            ser.Points.Add(serie.Points(i))
           Next
    Next

Now, each point will have a LabelToolTip. Previously, you weren't setting the tooltips, and they will not display until they are set.