Results 1 to 4 of 4

xy scatter charts

Threaded View

  1. #3
    Registered User
    Join Date
    10-30-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: xy scatter charts

    This may be stale seeing that my response is 6 years later but FYI only I've managed to by pure accident to achieve a very very similar solution to Tusha Mehtar's Hover Label tool.

    First it involves setting the labels using Rob Bovey's very handy (and free ! how crazy is that ?!) XYChartLabeller <http://www.appspro.com/Utilities/ChartLabeler.htm>

    After which you stick this piece of code in the private module of the relevant chart you want this to work on

    Private Sub Chart_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 chart_data As Variant, chart_label As Variant
    Dim last_bar As Long, chrt As Chart
    Dim ser As Series, Txt As String
    
    On Error Resume Next 
    
    Me.GetChartElement x, y, ElementID, Arg1, Arg2
    
    Set chrt = ActiveChart
    Set ser = ActiveChart.SeriesCollection(1)
    chart_data = ser.Values
    chart_label = ser.XValues
    
    If ElementID = xlDataLabel Then
    
    ActiveChart.SeriesCollection(1).Points(Arg2).DataLabel.Font.ColorIndex = 5
    ActiveChart.SeriesCollection(1).Points(Arg2).DataLabel.Font.Size = 10
    ActiveChart.SeriesCollection(1).Points(Arg2).DataLabel.Font.Bold = True
    
    Else
      ActiveChart.SeriesCollection(1).DataLabels.Font.Size = 1
      ActiveChart.SeriesCollection(1).Points(Arg2).DataLabel.Font.ColorIndex = 15
    
    End If
    
    End Sub
    Last edited by arlu1201; 11-25-2012 at 01:35 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1