Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Binge Fischer   on Feb 23 In MS Office Category.

  
Question Answered By: Julia Silva   on Feb 23

I sent an example  file to bigrho1, but for the rest of the group, if
you are interested in how to make custom chart  tips, read on...

Work through the examples here:

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

Using the data from the original email below, add a scatter chart to
your sheet. *Select* your chart and draw a rectangle *inside* it.
This will later be used to display the custom chart tips on the
chart, so make it sized for 2 lines of text and whatever color you
want. Disable the normal excel "Chart Tips" under Tools-Options-
Chart-Chart Tips.

Then, use the modified code below  for your MouseMove events.

A drawback is that the chart has to be selected for this to work.

Private Sub myChartClass_MouseMove(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 hover 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)
'Get the names
f = .SeriesCollection(Arg1).Formula
i2 = InStr(1, f, ",")
f = Mid(f, 9, i2 - 9)
myN = Range(f).Offset(Arg2, 1)
'move label to cursor location
.Shapes(1).Left = x * 0.75 + 10
.Shapes(1).Top = y * 0.75
'update the label caption
.Shapes(1).DrawingObject.Caption = myN & vbLf & myX
& ", " & myY
End If
End If
End With

End Sub

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Scatter Chart Or get search suggestion and latest updates.


Tagged: