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.worksheets.get(0).charts;
Methods
| Method | Description |
|---|---|
| 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(Uint8Array, 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() | @deprecated. Please use the ‘count’ property instead. 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:
| Parameter | Type | Description |
|---|---|---|
| index | number | The 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:
| Parameter | Type | Description |
|---|---|---|
| name | string | The 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:
| Parameter | Type | Description |
|---|---|---|
| type | ChartType | Chart type |
| left | number | The x offset to corner |
| top | number | The y offset to corner |
| width | number | The chart width |
| height | number | The 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:
| Parameter | Type | Description |
|---|---|---|
| type | ChartType | Chart type |
| upperLeftRow | number | Upper left row index. |
| upperLeftColumn | number | Upper left column index. |
| lowerRightRow | number | Lower right row index |
| lowerRightColumn | number | Lower right column index |
Returns
Chart object index.
add(Uint8Array, string, boolean, number, number, number, number)
Adds a chart with preset template.
add(data: Uint8Array, dataRange: string, isVertical: boolean, topRow: number, leftColumn: number, rightRow: number, bottomColumn: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| data | number[] | The data of chart template file(.crtx). |
| dataRange | string | Specifies the data range of the chart |
| isVertical | boolean | Specifies whether to plot the series from a range of cell values by row or by column. |
| topRow | number | Upper left row index. |
| leftColumn | number | Upper left column index. |
| rightRow | number | Lower right row index |
| bottomColumn | number | Lower 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:
| Parameter | Type | Description |
|---|---|---|
| type | ChartType | Chart type |
| dataRange | string | Specifies the data range of the chart |
| isVertical | boolean | Specifies whether to plot the series from a range of cell values by row or by column. |
| topRow | number | Upper left row index. |
| leftColumn | number | Upper left column index. |
| rightRow | number | Lower right row index |
| bottomColumn | number | Lower right column index |
Returns
Chart object index.
removeAt(number)
Remove a chart at the specific index.
removeAt(index: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| index | number | The chart index. |
clear()
Clear all charts.
clear() : void;
getCount()
@deprecated. Please use the ‘count’ property instead. Gets the number of elements contained in.
getCount() : number;
isNull()
Checks whether the implementation object is null.
isNull() : boolean;