Customizing Chart Elements > Programming ChartLabels > Defining the ChartLabel |
The ChartLabel object provides a number of properties that help you define and position the chart label. The most important of these properties are:
· The Text property specifies the text to appear in the chart label, and is of type Label.
· The Anchor property specifies the location of the chart label relative to the location to which it is attached. The location is specified as an anchorconstant, which represents a compass direction.
· The IsConnected property is a Boolean which specifies whether a line is to be drawn from the chart label to its attached location. If True, the line is drawn.
· The Offset property specifies the distance, in the anchor direction, from the chart label to its attached location, and is of type Long.
The following code sets the above properties:
With Chart2D1.ChartLabels(1)
.Text = "Here is my chart label"
.Anchor = oc2dAnchorSouthWest
.Offset = 20
.IsConnected = True
End With