# Attaching the Chart Label by Data Point and Y Value

## Content



The two methods, attaching the ChartLabel by data coordinate and attaching the ChartLabel by data point, can be combined so that a ChartLabel is attached to a location whose X-coordinate is specified by a data point and whose Y-coordinate is specified by a chart value. Note that this method is not supported in Pie charts.

To attach the ChartLabel by data point and Y value, set the **AttachMethod** property to AttachMethodEnum.**DataIndexY**, and then under the AttachMethodData object set the **GroupIndex**, **SeriesIndex**, **PointIndex**, and [Y](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.AttachMethodData.Y.html) properties.

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.DataIndex
        .AttachMethodData.GroupIndex = 0
        .AttachMethodData.SeriesIndex = 1
        .AttachMethodData.PointIndex = 2
        .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.DataIndex;
lab.AttachMethodData.GroupIndex = 0;
lab.AttachMethodData.SeriesIndex = 1;
lab.AttachMethodData.PointIndex = 2;
lab.AttachMethodData.Y = 15.8;
```

DOC-DETAILS-TAG-CLOSE

In this example, the ChartLabel location is specified as follows:

*   The X-coordinate of the second point in the first data series becomes the X-coordinate of the chart label.
*   The Y-coordinate specified by the [Y](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.AttachMethodData.Y.html) property becomes the Y-coordinate of the chart label.


> type=note
> **Note**: This method is not supported in Pie charts.

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

## See Also

[Anchoring Chart Labels](/componentone/docs/win/online-chart2d/chartinglabels/anchoringchartlabels)