To add a data label on top of each bar, use the following code:
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
End Sub
•C#
{
ChartDataSeriesCollection sc = C1Chart1.ChartGroups(0).ChartData.SeriesList;
int i = 0;
for (i = 0; i <= sc.Count - 1; i++) {
{
sc(i).DataLabel.Visible = true;
sc(i).DataLabel.Compass = LabelCompassEnum.North;
sc(i).DataLabel.Text = "{#YVAL}";
}
}
}