Hello,
So far I have produced a scatter graph that has two different values and I have installed the XY labeler to show the relevant data labels. Is it possible to only view the label of a point when it is hovered over?
Regards Stephen
Hello,
So far I have produced a scatter graph that has two different values and I have installed the XY labeler to show the relevant data labels. Is it possible to only view the label of a point when it is hovered over?
Regards Stephen
Here's one way using the Mouse Move event of the chart object. Please see the attachment.
You can see the code on the Chart1 tab in the VBA editor (Alt F11).
Martin
Heya,
I have had a look at the one you sent me and it is exactly what I am after, although I don't quite understand how it works. How can I customise the code to select my own data range? What is the Arg1/Arg2?
Private Sub Chart_MouseMove(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long)
Dim ElementID As Long
Dim Arg1 As Long
Dim Arg2 As Long
Me.GetChartElement x, y, ElementID, Arg1, Arg2
If ElementID = 3 Then
ActiveChart.SeriesCollection(Arg1).Points(Arg2).ApplyDataLabels
ActiveChart.SeriesCollection(Arg1).Points(Arg2).DataLabel.Font.Size = 16
ActiveChart.SeriesCollection(Arg1).Points(Arg2).DataLabel.Text = Sheets("Sheet1").Cells(Arg2 + 1, 1)
Else
On Error Resume Next
ActiveChart.SeriesCollection(1).DataLabels.Delete
On Error GoTo 0
End If
End Sub
Regards Stephen
The code is not setting the data range. Right click on the chart and select source data to do this.
Arg1 is the series (1 in this case) and Arg2 is the index of the data point within the series.
Got it! Thank you
Hello again,
I am having some trouble but I am not sure why. I am using the autofilter to get the range of data I need for the graph, when I am selecting just the males some of the data gets mixed up with a different label or some of the females data is displayed. Can you help?
Stephen
Try this alternative
Please Login or Register to view this content.
...........
Last edited by steve145; 02-19-2013 at 09:26 AM.
Hello,
Seems to be working perfectly and has even fixed another problem I was having
Thank you very much!
Stephen
Hello,
Sorry about this, but the points are now displaying the label that is two above from the data.
Stephen
I think I may have sorted it by changing the N = 3 to N = 5
Try playing with the value of C in the following. e.g. C = 2 or C = -2
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks