The visibility of a data label is controlled through the Visible property of the NDataLabelStyle object. By default it is set to true and series data labels are visible. The following code hides all data labels:
C# |
Copy Code
|
---|---|
bar.DataLabelStyle.Visible = false;
|
Visual Basic |
Copy Code
|
---|---|
bar.DataLabelStyle.Visible = False
|
If you want to display a data label only at some specific index (for example 3), you have to use the following code:
C# |
Copy Code
|
---|---|
NDataLabelStyle dataLabel = new NDataLabelStyle(); dataLabel.Visible = true; dataLabel.Format = ""; series.DataLabelStyle.Visible = false; series.DataLabelStyles[3] = dataLabel; |
Visual Basic |
Copy Code
|
---|---|
Dim dataLabel As NDataLabelStyle = New NDataLabelStyle dataLabel.Visible = True dataLabel.Format = "" series.DataLabelStyle.Visible = False series.DataLabelStyles(3) = dataLabel |
In the same manner you can use individual NDataLabelStyle objects for the data points in order to override the other properties of the default data label style. For example you can display data labels with different text color or formatting.