How do I show data labels in a scatter chart?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have plotted data against two axes and want to show the territory to which
these relate.
 
Double click the chart to edit it. Right click in the "white space" of the
chart and choose chart options. Click on the Data Labels tab.

Glenna
 
I have the same problem, if i have a data for scatter chart
e.g. England (9.0% on x-axis and 20% on y-axis) it show up fine, but I wish
to have the data label showing "England" instead of 20% or 9.0%. Can that me
automatically be done in powerpoint or even excel scatter charts?
 
Hi Alicia / Glenna / KevB,

In Excel there is a solution. See VBA code below. It comes from Samples.xls
from MS.
I changed my version a bit: it works on the second chart in a worksheet
(that's how I
needed it).

Frans

'==================
Sub ChartXYLabelsAdd()
Dim myTeller As Integer
Dim myWerkblad As String
Dim myXwaarden As String
Dim myXcel As Range
Dim myXlabel As String
Application.ScreenUpdating = False
ActiveSheet.ChartObjects(2).Select
myXwaarden = ActiveChart.SeriesCollection(1).Formula
myWerkblad = ActiveSheet.Name
myXwaarden = Application.Substitute(myXwaarden, myWerkblad, "xlBlad")
myXwaarden = Right(myXwaarden, Len(myXwaarden) - InStr(1, myXwaarden,
","))
If Left(myXwaarden, 1) = "," Then
MsgBox "XY-chart expects X-values." & vbCr & vbCr & _
"Macro aborted."
Exit Sub
End If
myXwaarden = Left(myXwaarden, InStr(1, myXwaarden, ",") - 1)
myXwaarden = Application.Substitute(myXwaarden, "xlBlad", myWerkblad)
myTeller = 1
For Each myXcel In Range(myXwaarden)
myXlabel = myXcel.Offset(0, -1).Value
With ActiveChart.SeriesCollection(1).Points(myTeller)
.HasDataLabel = True
.DataLabel.Text = myXlabel
End With
myTeller = myTeller + 1
Next
ActiveCell.Select
End Sub
'==================
Sub ChartXYLabelsVerwijderen()
Dim myPoint As Point
ActiveSheet.ChartObjects(2).Select
For Each myPoint In ActiveChart.SeriesCollection(1).Points
myPoint.HasDataLabel = False
Next
ActiveCell.Select
End Sub

'==================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top