| Charting Labels > Attaching and Positioning Chart Labels > Attaching the Chart Label by Data Point |
To attach a ChartLabel to a data point, set the AttachMethod property to AttachMethodEnum.DataIndex, and then under the AttachMethodData object set the GroupIndex, SeriesIndex, and PointIndex properties. These properties specify the ChartGroup, Series, and Point indices. PointIndex refers to the element of the data array. SeriesIndex refers to the element of the series array. Each series has arrays of data.
The following code example attaches a ChartLabel to a data point:
To write code in Visual Basic
To write code in C#
For more information on how to attach the chart label by data point at design time see, Attach by Data Index.