Something I'm writing in Google Apps Script
for Google Sheets
generates a chart. I'd like to have it generate a power series trendline, however I cannot figure out how to do this in Google Apps Script
. I can generate a polynomial or linear trendline, but I cannot figure out how to have it do it as a power series.
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var chartBuilder = sheet.newChart();
chartBuilder.setChartType(Charts.ChartType.SCATTER)
.addRange(range)
.setOption("pointSize", 1)
.setPosition(1, 1, 150, 0)
.setOption("trendlines", {0: {type: "power series", visibleInLegend: true}});
sheet.insertChart(chartBuilder.build());
Help would be greatly appreciated. Thank you!
Thank you to |'-'| for finding the answer. Turns out the option is "powerSeries"
not "power series"
(man, I feel stupid). Google really ought to make that more clear in their documentation.