I have a Google Sheets spreadsheet with a chart. I'd like to customize the chart colors beyond what is available in the default color palette. I believe this should be possible with Apps Scripts. But I cannot get the following to work for a Line Chart:
function chartColors() {
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange("A1:I100")
var chart = sheet.getCharts()[0];
chart = chart.modify()
.setOption('colors', ['red', 'blue', 'green', 'black'])
.build();
sheet.updateChart(chart);
};
Here is the example I am trying to follow: https://developers.google.com/apps-script/reference/spreadsheet/embedded-chart
I was able to Update Title, but the colors aren't working for some reason.
Suggestions?
.setOption('colors', ['red', 'blue', 'green', 'black'])but it works if I change it to.setOption('slices', ['red', 'blue', 'green', 'black'])- Aaron Dunigan AtLee