I am trying to adjust the position of Google Apps Script chart on Google Slide. First, the chart is created on a spreadsheet and inserted into the slide. I tried to change the position to right side or center using setLeft()
and alignOnPage()
methods. But still, the image is positioned top left on the slide. Could someone please show me the proper way to place the chart on the slide? Thank you!
var chart2 = sheet.newChart().setChartType(Charts.ChartType.PIE).addRange(sheet.getRange(range2)).setOption('applyAggregateData',0).setPosition(5, 5, 0, 0).build();
sheet.insertChart(chart2);
shapes = slide.getShapes();
slide.insertSheetsChart(chart2).setLeft(0).alignOnPage(SlidesApp.AlignmentPosition.CENTER).setWidth(300).setHeight(185);