I am trying to set a fixed minimum value in a chart created programmatically in my Google spreadsheet. The goal is that I want to create several graphs with the same limits, even if their data is very different.
In this example, I have the following data in my table:
Date Number 05.02.2017 125 06.02.2017 150 16.02.2017 21 05.02.2018 -5.333333333 06.02.2018 -57.33333333 16.02.2018 -109.3333333 05.02.2019 -161.3333333
and the following script:
function update() { var title = 'Last updated ' + new Date().toString(); var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var chart = sheet.newChart() .setChartType(Charts.ChartType.AREA) .addRange(sheet.getRange("A1:B8")) .setPosition(5, 5, 0, 0) .setOption('title', title) .setOption('vAxis.minValue', -5000) .setOption('vAxis.viewWindow.min', -5000) .build(); sheet.insertChart(chart); }
... so, in other words, I'm trying to set the minimum value to -5000. Installing vAxis.minValue and / or vAxis.viewWindow.min does nothing. (Yes, I know that my code will create new every time update () is called, but that is not the case.)
When editing a chart, there is a minimum / maximum value option. No values ββavailable: 
What should I do to programmatically change these values?
The full link to the sheet is here: https://docs.google.com/spreadsheets/d/1dKBG8Nx5mypD2YAfOTCzo2cvIX6C7R18SCIsNB5FsT0/edit?usp=sharing
google-apps-script
Christian neverdal
source share