officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-series-a9172a3b.md
Provides access to a collection of data labels customized for specific data points or for the entire series.
Namespace : DevExpress.Spreadsheet.Charts
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
DataLabelCollection CustomDataLabels { get; }
ReadOnly Property CustomDataLabels As DataLabelCollection
| Type | Description |
|---|---|
| DataLabelCollection |
A DataLabelCollection containing data labels with settings different from chart defaults.
|
To specify data label options for all series in a particular ChartView, use the ChartView.DataLabels property. The CustomDataLabels enables you to change data label settings for a specific series and for particular data points within the series. To change a data label for a specific data point, add an item with an index equal to the index of the data point to the data label collection. After that, change the properties of the added item as required.
Worksheet worksheet = workbook.Worksheets["chartTask3"];
workbook.Worksheets.ActiveWorksheet = worksheet;
// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet["B2:D4"]);
chart.TopLeftCell = worksheet.Cells["H2"];
chart.BottomRightCell = worksheet.Cells["N14"];
// Display data labels for the second series.
chart.Series[1].CustomDataLabels.ShowValue = true;
chart.Series[1].UseCustomDataLabels = true;
Dim worksheet As Worksheet = workbook.Worksheets("chartTask3")
workbook.Worksheets.ActiveWorksheet = worksheet
' Create a chart and specify its location.
Dim chart As Chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet("B2:D4"))
chart.TopLeftCell = worksheet.Cells("H2")
chart.BottomRightCell = worksheet.Cells("N14")
' Display data labels for the second series.
chart.Series(1).CustomDataLabels.ShowValue = True
chart.Series(1).UseCustomDataLabels = True
The following code snippets (auto-collected from DevExpress Examples) contain references to the CustomDataLabels property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
wpf-spreadsheet-chart-api/CS/SpreadsheetWPFChartAPISamples/CodeExamples/DataLabelsActions.cs#L139
chart.Series[0].UseCustomDataLabels = true;
var customDataLabels = chart.Series[0].CustomDataLabels;
customDataLabels.SetReference("D3:D8");
winforms-spreadsheet-chart-api/CS/SpreadsheetChartAPISamples/CodeExamples/DataLabelsActions.cs#L138
chart.Series[0].UseCustomDataLabels = true;
var customDataLabels = chart.Series[0].CustomDataLabels;
customDataLabels.SetReference("D3:D8");
wpf-spreadsheet-chart-api/VB/SpreadsheetWPFChartAPISamples/CodeExamples/DataLabelsActions.vb#L142
chart.Series(0).UseCustomDataLabels = True
Dim customDataLabels = chart.Series(0).CustomDataLabels
customDataLabels.SetReference("D3:D8")
winforms-spreadsheet-chart-api/VB/SpreadsheetChartAPISamples/CodeExamples/DataLabelsActions.vb#L139
chart.Series(0).UseCustomDataLabels = True
Dim customDataLabels = chart.Series(0).CustomDataLabels
customDataLabels.SetReference("D3:D8")
See Also