I'm trying to color a specific column on a column chart in Excel for web using Office Scripts. I'm able to set the color of all columns using this code:
function main(workbook: ExcelScript.Workbook) {
const sheet = workbook.getWorksheet("mySheet")
const chart = sheet.getChart("myChart")
const series = chart.getSeries()[0]
series.getFormat().getFill().setSolidColor("red")
}
But when I try to specify a certain point with this:
function main(workbook: ExcelScript.Workbook) {
const sheet = workbook.getWorksheet("mySheet")
const chart = sheet.getChart("myChart")
const series = chart.getSeries()[0]
const i = 2
const point = series.getPoints()[i]
point.getFormat().getFill().setSolidColor("red")
}
Then on the line const point = series.getPoints()[i] I get the error
ChartSeries getPoints: There was an internal error while processing the request.
To simplify as much as possible, I've make a new workbook with only this new chart in it, using the data to its side, which still gives me the same error. Here is a screenshot of the chart.
On further testing, this does work correctly when running the script on the desktop version. This error occurs only in the browser version, which unfortunately I must use