Description
Represents the data label on a chart point or trendline.
Accessors
For a series, the data labels for all points on the series are contained in a DataLabels collection. For a series without definable points (such as an area series), the DataLabels collection contains a single data label. To access a single member of the collection, use the DataLabels method with the data label index number as an argument. The following example sets the number format for data label five of series one in embedded chart one on worksheet one.
Worksheets(1).ChartObjects(1).Chart _ .SeriesCollection(1).DataLabels(5).NumberFormat = "0.000"
The DataLabel property returns the data label for a single point. The following example turns on the data label for point two on series one on the chart sheet named "Chart1" and sets the data label text to "Saturday".
With Charts("chart1") With .SeriesCollection(1).Points(2) .HasDataLabel = True .DataLabel.Text = "Saturday" End With End With
On a trendline, the DataLabel property returns the text shown with the trendline. This can be the equation, the R-squared value, or both (if both are showing). The following example sets the trendline text to show only the equation and then places the data label text in cell A1 on the worksheet named "Sheet1."
With Charts("chart1").SeriesCollection(1).Trendlines(1) .DisplayRSquared = False .DisplayEquation = True Worksheets("sheet1").Range("a1").Value = .DataLabel.Text End With
Properties
Application Property, AutoText Property, Border Property, Caption Property, Creator Property, Font Property, HorizontalAlignment Property, Interior Property, Left Property, Name Property, NumberFormat Property, NumberFormatLinked Property, Orientation Property, Parent Property, Shadow Property, ShowLegendKey Property, Text Property, Top Property, Type Property, VerticalAlignment Property.
Methods
Characters Method, Delete Method, Select Method.