Thread: Scatter chart
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Leo Heuser Leo Heuser is offline
external usenet poster
 
Posts: 266
Default Scatter chart

"Louise" skrev i en meddelelse
...
Hi all
I have created a basic worksheet, as shown below, and am trying to create
a
scatter chart from the results. The problem I have is that I want each
Point
on the chart to show the corresponding letter in Column A, however, if I
include Column A in the range, this is obviously shown on th chart as
well,
which is incorrect.

A B C

a 1 2
b 2 4
c 3 2
d 4 3
e 5 7
f 6 1
g 7 9
h 8 4
I 9 5
j 10 6
k 11 3
l 12 10
m 13 8
n 14 9


Any idea how I can do this? (I do have a worksheet containing the basic
data and chart so far if anybody is willing to take a look?)

Thank you.

Louise



Hi Louise

You want to add labels to the chart.
Assuming the labels, you want to insert are in A2:A15,
this sub will do the job.
To find the name of the diagram, click a random cell, press
<Ctrl and while holding it click the diagram. You can now
see the name in the name box (to the extreme left of the
formula bar)

1. Insert the sub in a general module: <Alt<F11, menu
Insert Module. Copy the sub and paste it to the righthand
window.

2. Alter name of sheet and name of diagram (and range) to
actual names.

3. Return to the sheet with <Alt<F11 and run
the sub with <Alt<F8

The sub must be run every time you add new points to the chart.


Sub InsertLabels()
'leo.heuser, oktober 2000
'Insert labels in a scatter graph
'
Dim Counter As Long
Dim Counter1 As Long
Dim LabelName As Variant

LabelName = Sheets("Sheet1").Range("A2:A15")

With Sheets("Sheet1").ChartObjects("Diagram 1").Chart
For Counter = 1 To .SeriesCollection.Count
For Counter1 = LBound(LabelName, 1) To _
UBound(LabelName, 1)
With .SeriesCollection(Counter)
.HasDataLabels = True
.Points(Counter1).DataLabel.Text = _
LabelName(Counter1, 1)
End With
Next Counter1
Next Counter
End With
End Sub



--
Best regards
Leo Heuser

Followup to newsgroup only please.