ChartSeries Object (JavaScript API for Excel)

Represents a series in a chart.

Properties

Property Type Description Req. Set
name string Represents the name of a series in a chart. 1.1

See property access examples.

Relationships

Relationship Type Description Req. Set
format ChartSeriesFormat Represents the formatting of a chart series, which includes fill and line formatting. Read-only. 1.1
points ChartPointsCollection Represents a collection of all points in the series. Read-only. 1.1

Methods

None

Method Details

Property access examples

Rename the 1st series of Chart1 to "New Series Name"

Excel.run(function (ctx) { 
    var chart = ctx.workbook.worksheets.getItem("Sheet1").charts.getItem("Chart1"); 
    chart.series.getItemAt(0).name = "New Series Name";
    return ctx.sync().then(function() {
            console.log("Series1 Renamed");
    });
}).catch(function(error) {
        console.log("Error: " + error);
        if (error instanceof OfficeExtension.Error) {
            console.log("Debug info: " + JSON.stringify(error.debugInfo));
        }
});
ters
Parameter Type Description  
param object Optional. Accepts parameter and relationship names as delimited string or an array. Or, provide loadOption object.  

Returns

void

Property access examples

Rename the 1st series of Chart1 to "New Series Name"

Excel.run(function (ctx) { 
    var chart = ctx.workbook.worksheets.getItem("Sheet1").charts.getItem("Chart1"); 
    chart.series.getItemAt(0).name = "New Series Name";
    return ctx.sync().then(function() {
            console.log("Series1 Renamed");
    });
}).catch(function(error) {
        console.log("Error: " + error);
        if (error instanceof OfficeExtension.Error) {
            console.log("Debug info: " + JSON.stringify(error.debugInfo));
        }
});