First I couldn't find how to set the dimension for an embedded chart.
The solution to that was setOption('width', width) + setOption('height', height)
Now I want to set the min and max values for the vertical axis when I create the chart.
Google's doc just says ...
setOption(name, value)
Sets advanced options for this chart. See https://developers.google.com/chart/interactive/docs/reference for what options are available.
... but I cant find the name of the available options there.
I.e. I lack the method setDimension(pixwidth, pixheight) in the EmbeddedChartBuilder ...
function addChart(dataSheetName) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('Graphs');
var dataSheet = SpreadsheetApp.getActive().getSheetByName(dataSheetName);
var dataRange = dataSheet.getDataRange();
var chart = sheet.newChart()
.setChartType(Charts.ChartType.LINE)
.addRange(dataRange)
.setPosition(5, 1, 0, 0)
// .setDimension(800, 400) // This method does not exist!
.build();
sheet.insertChart(chart);
}
I found it ...
.setOption('width', 700)
.setOption('height', 200)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With