In office/excel script, how to change the name of the first series?

Al Shahriar 0 Reputation points
2023-11-08T18:05:38.9433333+00:00

I am plotting the data as follows

const chart1 = sheet.addChart(ExcelScript.ChartType.xyscatterLines, r1);

Then, I added another series

let firstSeries = chart1.addChartSeries(); 
firstSeries.setName("Force")

Here, I can set the series name as "Force".

How can I change the name of the initial one (range object r1) to "Torque"?

Microsoft 365 and Office Development Other
Microsoft 365 and Office Excel For business Windows
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.