# Adding a Data Label on Top of Each Bar

## Content



To add a data label on top of each bar, use the following code:

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in Visual Basic

DOC-SUMMARY-TAG-CLOSE

```vbnet
Dim sc As ChartDataSeriesCollection =        
C1Chart1.ChartGroups(0).ChartData.SeriesList        
Dim i As Integer        
For i = 0 To sc.Count - 1        
With sc(i).DataLabel        
        .Visible = True        
        .Compass = LabelCompassEnum.North
        .Text = "{#YVAL}"        
End With        
Next
```

DOC-DETAILS-TAG-CLOSE

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in C#

DOC-SUMMARY-TAG-CLOSE

```csharp
ChartDataSeriesCollection sc = c1Chart1.ChartGroups[0].ChartData.SeriesList;
int i = 0;
for (i = 0; i <= sc.Count - 1; i++)
{
    var _with1 = sc[i].DataLabel;
    _with1.Visible = true;
    _with1.Compass = LabelCompassEnum.North;
    _with1.Text = "{#YVAL}";
}
```

DOC-DETAILS-TAG-CLOSE

## See Also

[Wrapping Labels](/componentone/docs/win/online-chart2d/chartforwinformstask/wrappinglabels)