![]() |
Labeling points in an X-Y scatter graph?
I'm using Excel 97. I'd like to label the points in an X-Y scatter graph. I
don't want to put the data values at the points, but a text label of my own choosing. Is this possible? Thanks, Don <donwiss at panix.com. |
Labeling points in an X-Y scatter graph?
Hi Don,
The simpliest way to do this to my reckoning is to programmatically turn on the data labels and apply text to them as in the example code below. Advised is that you don't select the option to display the data labels but instead rely on the code to do this. This way, you don't need to have a data label for all points, only the ones of your choosing. The example code below uses a loop to individually turn on and apply a month name to the first five points in the selected series. The line ".HasDataLabel = True" turns on the individual point and ".DataLabel.Text = Ar(i)" applies the chosen text to the particular label (in this case an element from an array). Sub ChangeDataLabels() Dim Ar As Variant, i As Integer Ar = Array("Jan", "Feb", "Mar", "Apr", "May") For i = 1 To 5 With ActiveSheet.ChartObjects(1).Chart. _ SeriesCollection(1).Points(i) .HasDataLabel = True .DataLabel.Text = Ar(i) End With Next End Sub Hope it's what you were looking for. Regards, Greg -----Original Message----- I'm using Excel 97. I'd like to label the points in an X- Y scatter graph. I don't want to put the data values at the points, but a text label of my own choosing. Is this possible? Thanks, Don <donwiss at panix.com. . |
Labeling points in an X-Y scatter graph?
Rob Bovey has a free add-in, the XY Chart Labeler, that you can use to
add the labels: http://www.appspro.com/utilities/Labeler.asp Don Wiss wrote: I'm using Excel 97. I'd like to label the points in an X-Y scatter graph. I don't want to put the data values at the points, but a text label of my own choosing. Is this possible? -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
Labeling points in an X-Y scatter graph?
Correction to my post:
I left out the declaration "Option Base 1" which should be placed at the top of the module. Regards, Greg -----Original Message----- Hi Don, The simpliest way to do this to my reckoning is to programmatically turn on the data labels and apply text to them as in the example code below. Advised is that you don't select the option to display the data labels but instead rely on the code to do this. This way, you don't need to have a data label for all points, only the ones of your choosing. The example code below uses a loop to individually turn on and apply a month name to the first five points in the selected series. The line ".HasDataLabel = True" turns on the individual point and ".DataLabel.Text = Ar(i)" applies the chosen text to the particular label (in this case an element from an array). Sub ChangeDataLabels() Dim Ar As Variant, i As Integer Ar = Array("Jan", "Feb", "Mar", "Apr", "May") For i = 1 To 5 With ActiveSheet.ChartObjects(1).Chart. _ SeriesCollection(1).Points(i) .HasDataLabel = True .DataLabel.Text = Ar(i) End With Next End Sub Hope it's what you were looking for. Regards, Greg -----Original Message----- I'm using Excel 97. I'd like to label the points in an X- Y scatter graph. I don't want to put the data values at the points, but a text label of my own choosing. Is this possible? Thanks, Don <donwiss at panix.com. . . |
All times are GMT +1. The time now is 11:59 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com