Sami.S
Sami.S

Reputation: 267

Create an Excel chart series using last API office.js

Can somebody tell me if is it possible to create a chart series using API office.js ? I found no method which can do this in the API documentation !

Thanks in advance ;-)

Upvotes: 1

Views: 436

Answers (1)

Michael Saunders
Michael Saunders

Reputation: 2668

One way to add a series is to modify the Source Data range to include additional rows or columns. That can be achieved via the Chart object:

Excel.run(function (ctx) { 
    var chart = ctx.workbook.worksheets.getItem("mySheet").charts.getItem("myChart"); 
    var biggerData = "A1:C4";
    chart.setData(biggerData, "Columns");
    return ctx.sync(); 
});

Upvotes: 1

Related Questions