ChDataLabelsCollection Collection
Multiple objects
Represents the collection of ChDataLabels objects for a data series. Each ChDataLabels object represents a set of data labels for a data series.
Using the ChDataLabelsCollection collection
Use the DataLabelsCollection property of the ChSeries object to return a DataLabelsCollection collection.
Use the Add method of the ChDataLabelsCollection collection to add a set of data labels to a data series.
The following example adds data labels to the first series in the first chart in Chartspace1, and then formats the data labels.
Sub AddDataLabels()
Dim serSeries1
Dim dlSeries1Labels
' Set a variable to the first series of the first chart
' in Chartspace1.
Set serSeries1 = ChartSpace1.Charts(0).SeriesCollection(0)
' Add a set of data labels to the first series and return
' a DataLabels object.
Set dlSeries1Labels = serSeries1.DataLabelsCollection.Add
' Set the number format of the data labels.
dlSeries1Labels.NumberFormat = "0.00"
' Set the data labels to display the category
' name for the data point.
dlSeries1Labels.HasCategoryName = True
' Set the data labels to display the value
' for the data point.
dlSeries1Labels.HasValue = True
End Sub