I'm making a stacked column chart with the EmbeddedChartBuilder and I cannot get some of the configuration options to work. I don't have a lot of knowledge when it comes to scripting, just picking up pieces here and there, so I'm at a loss.
This is my function (minus the series options to shorten it). The function does create a chart, but doesn't use all the .setOption configurations. I've highlighted the ones that don't work in yellow.
function newChart() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
var datasheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet2");
var data = datasheet.getRange("U4:AA9");
var chart = sheet.newChart().addRange(data)
.setChartType(Charts.ChartType.COLUMN)
.setOption('isStacked', true)
.setOption('width',500)
.setOption('height',288)
.setOption('legend', 'none')
.setPosition(2,2,1,0)
.setOption('backgroundColor',{stroke:'red', strokeWidth: 5})
.setOption('chartArea',{'left':50, 'top':50,'width':"50%",'height':"50%"})
.setOption('bar.groupWidth', '90%');
sheet.insertChart(chart.build());
}
Am I coding this incorrectly? I've wasted a lot of time looking stuff up online to no avail.