I have an embedded bar chart in a Google sheet. I'd like to change the color of the bars using Google Apps Script. I tried
var charts = sheet.getCharts();
var chart = charts[0];
chart = chart.modify()
.setOption('title', 'New Title')
.setOption('series.0.color', 'red')
.build();
sheet.updateChart(chart);
The title gets updated, but the color does not.
I also tried .setColors()
, with no effect either.
When a build a new chart (newChart()
) with the same
.setOption('series.0.color', 'red')
, the specified color is used.