All docs
V20.2
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

DataLabelCollection.SetVisibility(Int32, Boolean) Method

Shows or hides a data label for the specified data point.

Namespace: DevExpress.Spreadsheet.Charts

Assembly: DevExpress.Spreadsheet.v20.2.Core.dll

Declaration

void SetVisibility(
    int itemIndex,
    bool visible
)
Sub SetVisibility(
    itemIndex As Integer,
    visible As Boolean
)

Parameters

Name Type Description
itemIndex Int32

The zero-based position of the target data point within the series.

visible Boolean

true to display the label for the data point; otherwise, false.

Remarks

Use the DataLabelCollection.IsVisible method to determine whether a data label for a specific data point is displayed. The DataLabelCollection.HiddenLabels property returns the hidden label collection.

Show Individual Data Labels

The example below displays data labels for the minimum and maximum data points on the chart.

Specify data label visibility for the column chart

// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet["B2:C8"]);
chart.TopLeftCell = worksheet.Cells["F2"];
chart.BottomRightCell = worksheet.Cells["L15"];

// Hide the chart's legend.
chart.Legend.Visible = false;

chart.Series[0].UseCustomDataLabels = true;
// Display the label for the third data point (minimum value).
chart.Series[0].CustomDataLabels.SetVisibility(2, true);
// Display the label for the sixth data point (maximum value).
chart.Series[0].CustomDataLabels.SetVisibility(5, true);

Hide Individual Data Labels

The example below displays data labels for all data points on the chart except for the first point.

Hide a data label on the column chart

// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet["B2:C8"]);
chart.TopLeftCell = worksheet.Cells["F2"];
chart.BottomRightCell = worksheet.Cells["L15"];

// Hide the chart's legend.
chart.Legend.Visible = false;

chart.Series[0].UseCustomDataLabels = true;
// Display data point values.
chart.Series[0].CustomDataLabels.ShowValue = true;
// Hide the first data label.
chart.Series[0].CustomDataLabels.SetVisibility(0, false);
// You can also use the Hidden property to hide the label.
//chart.Series[0].CustomDataLabels.Add(0).Hidden = true;
See Also