Skip to content

Latest commit

 

History

History
106 lines (77 loc) · 2.67 KB

chartseriescollection.md

File metadata and controls

106 lines (77 loc) · 2.67 KB

ChartSeriesCollection

Represents a collection of chart series.

Property Type Description
count int Returns the number of series in the collection. Read-only.
items ChartSeries[] A collection of chartSeries objects. Read-only.

Relationships

None

Methods

Method Return Type Description
getItemAt(index: number) ChartSeries Retrieves a series based on its position in the collection
load(param: object) void Fills the proxy object created in JavaScript layer with property and object values specified in the parameter.

API Specification

getItemAt(index: number)

Retrieves a series based on its position in the collection

Syntax

chartSeriesCollectionObject.getItemAt(index);

Parameters

Parameter Type Description
index number Index value of the object to be retrieved. Zero-indexed.

Returns

ChartSeries

Examples

Get the name of the first series in the series collection.

var ctx = new Excel.RequestContext();
var seriesCollection = ctx.workbook.worksheets.getItem("Sheet1").charts.getItem("Chart1").series;
ctx.load(seriesCollection);
ctx.executeAsync().then(function () {
	Console.log(seriesCollection.items[0].name);
});

Back

load(param: object)

Fills the proxy object created in JavaScript layer with property and object values specified in the parameter.

Syntax

object.load(param);

Parameters

Parameter Type Description
param object Optional. Accepts parameter and relationship names as delimited string or an array. Or, provide loadOption object.

Returns

void

Examples

Back

Getter Examples

Getting the names of series in the series collection.

var ctx = new Excel.RequestContext();
var seriesCollection = ctx.workbook.worksheets.getItem("Sheet1").charts.getItem("Chart1").series;
ctx.load(seriesCollection);
ctx.executeAsync().then(function () {
	for (var i = 0; i < seriesCollection.items.length; i++)
	{
		Console.log(seriesCollection.items[i].name);
	}
});

Get the number of chart series in collection.

var ctx = new Excel.RequestContext();
var seriesCollection = ctx.workbook.worksheets.getItem("Sheet1").charts.getItem("Chart1").series;
ctx.load(seriesCollection);
ctx.executeAsync().then(function () {
	Console.log("series: Count= " + seriesCollection.count);
});

Back