How to set embedded chart parameters in Google Spreadsheets

At first I could not find how to set the size of the inline chart.

The solution for this was setOption ('width', width) + setOption ('height', height)

Now I want to set the minimum and maximum values โ€‹โ€‹for the vertical axis when creating the chart.

Google doc just says ...

setOption (name, value)

Sets advanced options for this chart. See https://developers.google.com/chart/interactive/docs/reference for options available.

... but I cannot find the available options there.

those. I am missing the setDimension (pixwidth, pixheight) method in 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); } 
+4
source share
3 answers

I found him...

 .setOption('width', 700) .setOption('height', 200) 
0
source

I found a list of chart options here: https://developers.google.com/chart/interactive/docs/gallery/linechart#configuration-options

There are options for width and height .

0
source

As the lactone answer is mentioned, the documentation is in the section of the siteโ€™s manuals related to the question. There is a section for each type of chart, indicated on the left side of the page, and each contains a list of configuration parameters, which describes in detail what you can use in script applications .setOption() .

The maximum and minimum values โ€‹โ€‹for the vertical axis are set using vAxis.maxValue and vAxis.minValue respectively, for example. .setOption('vAxis.maxValue',100) .

0
source

Source: https://habr.com/ru/post/1501163/


All Articles