ChartCollection

ChartCollection class

Encapsulates a collection of Chart objects.

class ChartCollection;

Example

const { Workbook } = require("aspose.cells.node");

var workbook = new Workbook();
var charts = workbook.getWorksheets().get(0).getCharts();

Methods

MethodDescription
get(number)Gets the Chart element at the specified index.
get(string)Gets the chart by the name.
addFloatingChart(ChartType, number, number, number, number)Adds a chart to the collection.
add(ChartType, number, number, number, number)Adds a chart to the collection.
add(number[], string, boolean, number, number, number, number)Adds a chart with preset template.
add(ChartType, string, boolean, number, number, number, number)Adds a chart to the collection.
removeAt(number)Remove a chart at the specific index.
clear()Clear all charts.
getCount()Gets the number of elements contained in.
isNull()Checks whether the implementation object is null.

get(number)

Gets the Chart element at the specified index.

get(index: number) : Chart;

Parameters:

ParameterTypeDescription
indexnumberThe zero based index of the element.

Returns

The element at the specified index.

get(string)

Gets the chart by the name.

get(name: string) : Chart;

Parameters:

ParameterTypeDescription
namestringThe chart name.

Returns

The chart.

Remarks

The default chart name is null. So you have to explicitly set the name of the chart.

addFloatingChart(ChartType, number, number, number, number)

Adds a chart to the collection.

addFloatingChart(type: ChartType, left: number, top: number, width: number, height: number) : number;

Parameters:

ParameterTypeDescription
typeChartTypeChart type
leftnumberThe x offset to corner
topnumberThe y offset to corner
widthnumberThe chart width
heightnumberThe chart height

Returns

Chart object index.

add(ChartType, number, number, number, number)

Adds a chart to the collection.

add(type: ChartType, upperLeftRow: number, upperLeftColumn: number, lowerRightRow: number, lowerRightColumn: number) : number;

Parameters:

ParameterTypeDescription
typeChartTypeChart type
upperLeftRownumberUpper left row index.
upperLeftColumnnumberUpper left column index.
lowerRightRownumberLower right row index
lowerRightColumnnumberLower right column index

Returns

Chart object index.

add(number[], string, boolean, number, number, number, number)

Adds a chart with preset template.

add(data: number[], dataRange: string, isVertical: boolean, topRow: number, leftColumn: number, rightRow: number, bottomColumn: number) : number;

Parameters:

ParameterTypeDescription
datanumber[]The data of chart template file(.crtx).
dataRangestringSpecifies the data range of the chart
isVerticalbooleanSpecifies whether to plot the series from a range of cell values by row or by column.
topRownumberUpper left row index.
leftColumnnumberUpper left column index.
rightRownumberLower right row index
bottomColumnnumberLower right column index

Returns

Chart object index.

add(ChartType, string, boolean, number, number, number, number)

Adds a chart to the collection.

add(type: ChartType, dataRange: string, isVertical: boolean, topRow: number, leftColumn: number, rightRow: number, bottomColumn: number) : number;

Parameters:

ParameterTypeDescription
typeChartTypeChart type
dataRangestringSpecifies the data range of the chart
isVerticalbooleanSpecifies whether to plot the series from a range of cell values by row or by column.
topRownumberUpper left row index.
leftColumnnumberUpper left column index.
rightRownumberLower right row index
bottomColumnnumberLower right column index

Returns

Chart object index.

removeAt(number)

Remove a chart at the specific index.

removeAt(index: number) : void;

Parameters:

ParameterTypeDescription
indexnumberThe chart index.

clear()

Clear all charts.

clear() : void;

getCount()

Gets the number of elements contained in.

getCount() : number;

isNull()

Checks whether the implementation object is null.

isNull() : boolean;