How do I get a label in a scatter plot instead of "Series 1 Point"?

Monsignor

Board Regular
Joined
May 30, 2011
Messages
162
I've got a scatter plot and when I hover over a point, it says something like:

Series 1 Point "1.03" (1.03, 4.12)
Series 1 Point "2.7" (2.7, 3.06)

I'd prefer for it to say:

Thomas (1.03, 4.12)
Leslie (2.7, 3.06)

I can get the labels onto the chart, the problem is when hovering the mouse, everything shows as "Series 1 Point." All of the names are in my first column, but I can't get the hover window to show them.
 
Last edited:

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
It works for me. How is your chart data layed out.

I put the series names in A2:A5
The X-axis values in B1:M1
And the Y-Axis values in B2:M5
A1 is blank

Used A1:M6 as the source data (series in rows) and made an XY Scatter chart

Hovering over any data point showed the Series Name (as seen in A2:A5) and the X,Y value
 
Upvote 0
Here is how the data looks.




hoverwindow.png
 
Upvote 0
Those little charttips that appear when you hover over the points are not very flexible. They are not actually labels, by the way. They show series name, point number (the X value), and the X and Y values in parentheses. Yeah, X appears twice.

In order to see the location, you need to set up the chart to have one series per row of the data. Tedious by hand, though possible. Easier with VBA. Here's something quick and dirty I cobbled together.

Code:
Sub ChartOneSeriesPerRow()
  If TypeName(Selection) <> "Range" Then GoTo BadData
  Dim DataRange As Range
  Set DataRange = Selection
  If DataRange.Areas.Count > 1 Then GoTo BadData
  If DataRange.Columns.Count <> 3 Then GoTo BadData

  Dim TheChart As Chart
  Set TheChart = ActiveSheet.Shapes.AddChart2(240, xlXYScatter).Chart
  
  Do While TheChart.SeriesCollection.Count > 0
    TheChart.SeriesCollection(1).Delete
  Loop
  
  Dim DataRow As Long
  For DataRow = 1 To DataRange.Rows.Count
    With TheChart.SeriesCollection.NewSeries
      .Values = DataRange.Cells(DataRow, 3)
      .XValues = DataRange.Cells(DataRow, 2)
      .Name = "=" & DataRange.Cells(DataRow, 1).Address(, , , True)
    End With
  Next
  
  TheChart.HasLegend = False
  
ExitSub:
  Exit Sub
  
BadData:
  MsgBox "Select a range with three columns Name, X, and Y", _
      vbExclamation, "Select Data"
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,496
Messages
6,113,993
Members
448,539
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top