Click or drag to resize

IChartDataLabels HasPercentage Property

Indicates whether percentage is in data labels.
Examples
The following code illustrates how to access the IChartDataLabels and set to shows the percentage values:
<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:C2"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.Pie;</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 percentage values</para><para>dataLabels.HasPercentage = 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 HasPercentage { get; set; }

Property Value

Type: Boolean
See Also