Click or drag to resize

IChartDataLabels HasLegendKey Property

Indicates whether legend key is in data labels.
Examples
The following code illustrates how to access the IChartDataLabels and set to shows the legend keys:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart and set range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C3"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.ColumnClustered;</para><para>//Get the chart serie</para><para>IChartSerie serie = chart.Series[0];</para><para>//Get serie data labels</para><para>IChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;</para><para>//Set the data label to show the legend key</para><para>dataLabels.HasValue = true;</para><para>dataLabels.HasLegendKey = true;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>

Namespace: Spire.Xls.Core
Assembly: Spire.XLS (in Spire.XLS.dll) Version: 15.4.0.0 (15.4.0.5046)
Syntax
bool HasLegendKey { get; set; }

Property Value

Type: Boolean
See Also