DataLabel Property

Microsoft Office Web Components Visual Basic

Returns a ChDataLabel object that represents the data label associated with the specified trendline. Read-only.

expression.DataLabel

expression    Required. An expression that returns a ChTrendline object.

Example

This example adds a trendline to the specified series in the chart workspace, sets the font for the data label to bold, and causes the trendline to display only its equation (the R-squared value is not displayed).

Sub AddTrendLine()
Dim trndline

' Add a trendline to the first series in the first chart in ChartSpace1.
Set trndline = ChartSpace1.Charts(0).SeriesCollection(0).Trendlines.Add

' Set the font of the trendline to bold.
trndline.DataLabel.Font.Bold = True

' Do not display the R-Squared value with the trendline.
trndline.IsDisplayingRSquared = False

' Display the equation for the trendline.
trndline.IsDisplayingEquation = True
End Sub