I'm generating a spreadsheet, several pivot tables, and charts to visualize the results. I have everything working, except I haven't found a way to set the number format for the chart horizontal/vertical axes. I want the axes to show whole numbers, without the need for me to change the number format of the backing data.
Unfortunately, the documentation provided by Google does not cover this feature: https://developers.google.com/apps-script/chart-configuration-options#line-chart-configuration-options.
It is possible to set the number format manually, however, as I'm generating a large number of charts, it would be too burdensome to do this for all charts.
Here is an example of the Apps Script code used to generate my charts:
embeddedChartBuilder.setChartType(Charts.ChartType.LINE)
.setPosition(chartRow, chartColumn, 0, 0)
.setNumHeaders(1)
.setOption('backgroundColor', '#222222')
.setOption('height', chartHeightPx)
.setOption('width', chartWidthPx)
.setOption('series', [
{color:'#4ebcbb', pointSize:6, lineWidth:4},
{color:'#cccccc', pointSize:6, lineWidth:4},
{color:'#666666', pointSize:6, lineWidth:4},
{color:'#34a853', pointSize:6, lineWidth:4}])
.setOption('applyAggregateData', 0)
.setOption('vAxis.gridlines.color', '#434343')
.setOption('vAxis.minValue', 0)
.setOption('vAxis.maxValue', 5)
.setOption('vAxis.textStyle', { color: '#efefef', fontName: 'Arial', fontSize: 12, bold: false, italic: false })
.setOption('hAxis.textStyle', { color: '#efefef', fontName: 'Arial', fontSize: 12, bold: false, italic: false });