PDA

View Full Version : Solved: Chart ControlTipText



jammer6_9
06-23-2009, 03:22 AM
I have created a Line Chart. In X-Axis I have 1 till 52 (As Weeks)... Once I move the mouse to certain point in the Plot Area, Controltiptext shows Series,Label
& values.

Is it possible change the ControlTiptext when I move or click my mouse to a certain point in the plot area?

jammer6_9
06-24-2009, 12:01 AM
Below code has solved my problem. It was exactly what I wanted :whistle:

Thanks to this site Link where I also dig it from VBAX...

http://www.computorcompanion.com/LPMArticle.asp?ID=221


Private Sub Chart_MouseUp(ByVal Button As Long, ByVal Shift As Long, _
ByVal x As Long, ByVal y As Long)

Dim ElementID As Long, Arg1 As Long, Arg2 As Long
Dim myX As Variant, myY As Double

With ActiveChart
' Pass x & y, return ElementID and Args
.GetChartElement x, y, ElementID, Arg1, Arg2

' Did we click over a point or data label?
If ElementID = xlSeries Or ElementID = xlDataLabel Then
If Arg2 > 0 Then
Extract x value from array of x values
myX = WorksheetFunction.Index _
(.SeriesCollection(Arg1).XValues, Arg2)
Extract y value from array of y values
myY = WorksheetFunction.Index _
(.SeriesCollection(Arg1).Values, Arg2)

' Display message box with point information
MsgBox "Series " & Arg1 & vbCrLf _
& """" & .SeriesCollection(Arg1).Name & """" & vbCrLf _
& "Point " & Arg2 & vbCrLf _
& "X = " & myX & vbCrLf _
& "Y = " & myY
End If
End If
End With

End Sub