0

I am writing an Excel add-in using MS Office JavaScript API

One of the tasks is to store charts in cloud and recreate them later. For creating a chart, the only function that the API is providing is

var chart = ctx.workbook.worksheets.getItem(sheetName).charts.add("pie", sourceData, "auto");

where sourceData must be am Excel range in A1:B2 format.

Unfortunately, when we iterate through all the charts in the sheet, the series object only contains values, no reference to the range is provided.

In the original VBA Excel model , the Series class had an additional Formula property, that is missing from the JS implementation.

Do you have any idea how to solve that ? How to get the series range for a chart ?

1 Answer 1

0

Maybe provide the 'sourceData' range as follows.

var sheet = ctx.workbook.worksheets.getActiveWorksheet();
var sourceData = sheet.getRange("A1:B6");
var chart = ctx.workbook.worksheets.getItem(sheetName).charts.add("pie", sourceData, "auto");

Placing directly as string "A1:B6" does not seem to work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.