Click or drag to resize

Chart DataTable Property

Returns a DataTable object that represents the chart data table.
Examples
The following code illustrates how to set HasDataTable to "true" to enable data table and set IChartDataTable.HasBorders to "false" to hide the borders of data table:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>worksheet.Range["A1"].Text = "Jan";
 worksheet.Range["B1"].Text = "Feb";
 worksheet.Range["C1"].Text = "Mar";
 worksheet.Range["A2"].Text = "10";
 worksheet.Range["B2"].Text = "20";
 worksheet.Range["C2"].Text = "30";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set Chart data table</para><para>chart.HasDataTable = true;</para><para>IChartDataTable dataTable = chart.DataTable;</para><para>//Set border</para><para>dataTable.HasBorders = false;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>

Namespace: Spire.Xls
Assembly: Spire.XLS (in Spire.XLS.dll) Version: 15.4.0.0 (15.4.0.5046)
Syntax
public ChartDataTable DataTable { get; }

Property Value

Type: ChartDataTable
See Also