ChartDataTable Class

Represents a chart data table.
Inheritance Hierarchy
SystemObject
  Aspose.Cells.ChartsChartDataTable

Namespace:  Aspose.Cells.Charts
Assembly:  Aspose.Cells (in Aspose.Cells.dll) Version: 20.10.0.0 (20.10)
Syntax
public class ChartDataTable

The ChartDataTable type exposes the following members.

Properties
  NameDescription
Public propertyAutoScaleFont
True if the text in the object changes font size when the object size changes. The default value is True.
Public propertyBackground Obsolete.
Gets and sets the display mode of the background
Public propertyBackgroundMode
Gets and sets the display mode of the background
Public propertyBorder
Returns a Border object that represents the border of the object
Public propertyFont
Gets a Font object which represents the font setting of the specified chart data table.
Public propertyHasBorderHorizontal
True if the chart data table has horizontal cell borders
Public propertyHasBorderOutline
True if the chart data table has outline borders
Public propertyHasBorderVertical
True if the chart data table has vertical cell borders
Public propertyShowLegendKey
True if the data label legend key is visible.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Examples
[C#]

//Instantiating a Workbook object
Workbook workbook = new Workbook();

//Obtaining the reference of the first worksheet
Worksheet worksheet = workbook.Worksheets[0];

//Adding a sample value to "A1" cell
worksheet.Cells["A1"].PutValue(50);

//Adding a sample value to "A2" cell
worksheet.Cells["A2"].PutValue(100);

//Adding a sample value to "A3" cell
worksheet.Cells["A3"].PutValue(150);

//Adding a sample value to "B1" cell
worksheet.Cells["B1"].PutValue(60);

//Adding a sample value to "B2" cell
worksheet.Cells["B2"].PutValue(32);

//Adding a sample value to "B3" cell
worksheet.Cells["B3"].PutValue(50);

//Adding a chart to the worksheet
int chartIndex = worksheet.Charts.Add(ChartType.Column, 5, 0, 25, 10);

//Accessing the instance of the newly added chart
Chart chart = worksheet.Charts[chartIndex];

//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
chart.NSeries.Add("A1:B3", true);

chart.IsDataTableShown = true;

//Getting Chart Table
ChartDataTable chartTable = chart.ChartDataTable;

//Setting Chart Table Font Color
chartTable.Font.Color = System.Drawing.Color.Red;

//Setting Legend Key VisibilityOptions
chartTable.ShowLegendKey = false;

//Saving the Excel file
workbook.Save("D:\\book1.xls");

[VB.NET]

'Instantiating a Workbook object
Dim workbook As New Workbook()

'Obtaining the reference of the first worksheet
Dim worksheet As Worksheet = workbook.Worksheets(0)

'Adding a sample value to "A1" cell
worksheet.Cells("A1").PutValue(50)

'Adding a sample value to "A2" cell
worksheet.Cells("A2").PutValue(100)

'Adding a sample value to "A3" cell
worksheet.Cells("A3").PutValue(150)

'Adding a sample value to "B1" cell
worksheet.Cells("B1").PutValue(60)

'Adding a sample value to "B2" cell
worksheet.Cells("B2").PutValue(32)

'Adding a sample value to "B3" cell
worksheet.Cells("B3").PutValue(50)

'Adding a chart to the worksheet
Dim chartIndex As Integer = worksheet.Charts.Add(ChartType.Column, 5, 0, 25, 10)

'Accessing the instance of the newly added chart
Dim chart As Chart = worksheet.Charts(chartIndex)

'Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
chart.NSeries.Add("A1:B3", True)

chart.IsDataTableShown = True

'Getting Chart Table
Dim chartTable As ChartDataTable = chart.ChartDataTable

'Setting Chart Table Font Color
chartTable.Font.Color = System.Drawing.Color.Red

'Setting Legend Key VisibilityOptions
chartTable.ShowLegendKey = False

'Saving the Excel file
workbook.Save("D:\book1.xls")
See Also