ChartDataTable
ChartDataTable class
Represents a chart data table.
class ChartDataTable;
Example
const { Workbook, ChartType, Color, SaveFormat } = AsposeCells;
//Instantiating a Workbook object
var workbook = new Workbook();
//Obtaining the reference of the first worksheet
var worksheet = workbook.worksheets.get(0);
//Adding a sample value to "A1" cell
worksheet.cells.get("A1").putValue(50);
//Adding a sample value to "A2" cell
worksheet.cells.get("A2").putValue(100);
//Adding a sample value to "A3" cell
worksheet.cells.get("A3").putValue(150);
//Adding a sample value to "B1" cell
worksheet.cells.get("B1").putValue(60);
//Adding a sample value to "B2" cell
worksheet.cells.get("B2").putValue(32);
//Adding a sample value to "B3" cell
worksheet.cells.get("B3").putValue(50);
//Adding a chart to the worksheet
var chartIndex = worksheet.charts.add(ChartType.Column, 5, 0, 25, 10);
//Accessing the instance of the newly added chart
var chart = worksheet.charts.get(chartIndex);
//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
chart.nSeries.add("A1:B3", true);
chart.showDataTable = true;
//Getting Chart Table
var chartTable = chart.getChartDataTable();
//Setting Chart Table Font Color
chartTable.font.color = Color.Red;
//Setting Legend Key Visibility
chartTable.showLegendKey = false;
//Saving the Excel file
var uint8Array = workbook.save(SaveFormat.Xlsx);
Properties
Property | Type | Description |
---|---|---|
font | Font | Readonly. Gets a Font object which represents the font setting of the specified chart data table. |
autoScaleFont | boolean | True if the text in the object changes font size when the object size changes. The default value is True. |
backgroundMode | BackgroundMode | Gets and sets the display mode of the background |
hasBorderHorizontal | boolean | True if the chart data table has horizontal cell borders |
hasHorizontalBorder | boolean | True if the chart data table has horizontal cell borders |
hasBorderVertical | boolean | True if the chart data table has vertical cell borders |
hasVerticalBorder | boolean | True if the chart data table has vertical cell borders |
hasBorderOutline | boolean | True if the chart data table has outline borders |
hasOutlineBorder | boolean | True if the chart data table has outline borders |
showLegendKey | boolean | True if the data label legend key is visible. |
border | Line | Readonly. Returns a Border object that represents the border of the object |
font
Readonly. Gets a Font object which represents the font setting of the specified chart data table.
font : Font;
autoScaleFont
True if the text in the object changes font size when the object size changes. The default value is True.
autoScaleFont : boolean;
backgroundMode
Gets and sets the display mode of the background
backgroundMode : BackgroundMode;
hasBorderHorizontal
True if the chart data table has horizontal cell borders
hasBorderHorizontal : boolean;
Remarks
NOTE: This property is now obsolete. Instead, please use ChartDataTable.HasHorizontalBorder property. This property will be removed 12 months later since June 2024. Aspose apologizes for any inconvenience you may have experienced.
hasHorizontalBorder
True if the chart data table has horizontal cell borders
hasHorizontalBorder : boolean;
hasBorderVertical
True if the chart data table has vertical cell borders
hasBorderVertical : boolean;
Remarks
NOTE: This property is now obsolete. Instead, please use ChartDataTable.HasVerticalBorder property. This property will be removed 12 months later since June 2024. Aspose apologizes for any inconvenience you may have experienced.
hasVerticalBorder
True if the chart data table has vertical cell borders
hasVerticalBorder : boolean;
hasBorderOutline
True if the chart data table has outline borders
hasBorderOutline : boolean;
Remarks
NOTE: This property is now obsolete. Instead, please use ChartDataTable.HasOutlineBorder property. This property will be removed 12 months later since June 2024. Aspose apologizes for any inconvenience you may have experienced.
hasOutlineBorder
True if the chart data table has outline borders
hasOutlineBorder : boolean;
showLegendKey
True if the data label legend key is visible.
showLegendKey : boolean;
border
Readonly. Returns a Border object that represents the border of the object
border : Line;