# Attaching the Chart Label by Data Coordinate

## Content



To attach a ChartLabel to a data coordinate on the chart, set the [AttachMethod](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.Label.AttachMethod.html) property to [AttachMethodEnum](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.AttachMethodEnum.html).**DataCoordinate**, and then under the [AttachMethodData](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.AttachMethodData.html) object set the [X](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.AttachMethodData.X.html) and [Y](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.AttachMethodData.Y.html) properties to the data coordinates at which the ChartLabel is to be attached. For example, the following attaches a ChartLabel to the data coordinate (1.1, 15.8):

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in Visual Basic

DOC-SUMMARY-TAG-CLOSE

```vbnet
With C1Chart1.ChartLabels.LabelsCollection(0)
    .AttachMethod = AttachMethodEnum.DataCoordinate
    .AttachMethodData.X = 1.1
    .AttachMethodData.Y = 15.8
End With
```

DOC-DETAILS-TAG-CLOSE

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in C#

DOC-SUMMARY-TAG-CLOSE

```csharp
C1.Win.C1Chart.Label lab = c1Chart1.ChartLabels.LabelsCollection[0];
lab.AttachMethod = AttachMethodEnum.DataCoordinate;
lab.AttachMethodData.X = 1.1;
lab.AttachMethodData.Y = 15.8;
```

DOC-DETAILS-TAG-CLOSE

ChartLabels can only be attached to a data coordinate if the chart is an Area or XY-Plot. Any part of the ChartLabel that falls outside of the ChartArea is clipped.

For more information on how to attach the chart label by data coordinate at design time see, [Attach by Data Coordinate](/componentone/docs/win/online-chart2d/chartforwinformstask/creatingandformattin1/attachchartlabels/attachbydatacoordina).

## See Also

[Attaching the Chart Label by Data Point](/componentone/docs/win/online-chart2d/chartinglabels/attachingandposition/attachingthechartlab2)