I have a script that creates a line chart. See the screen of data (each row = 1 separate chart with horizontal axis containing months (header row))
I cannot add a horizontal axis with months so I could get nice lines on a graph.
Right now statistics points are shown as dots instead of lines.
I looked through many topics and Google documentation on it but it's confusing to me.
Here's how I create a chart:
var chart = sheet.newChart()
.setChartType(Charts.ChartType.LINE)
.addRange(range) //pass a range with data from a sheet
.setPosition(3, 3, 0, 0)
.setOption("title", name)
.build();
sheet.insertChart(chart);
So it ads data as .addRange but how can I add months as horizontal axes
I get ranges dinamically when looping throught sheet cells (i from 1 to last row). That is an example where I send first 2 rows as a range (addRange()) and get first row to use as horizontal axis (headers).
var range = sheet.getRange(i, 3, 2, 12);
var months = sheet.getRange(1, 3, 1, 12)
This method doesn't add horizontal axis:
.setOption("hAxis", months)
addRange(months).addRange(range)oraddRange(months).addRange(range).setTransposeRowsAndColumns(true)- TheMastervar range = sheet.getRange(i, 3, 1, 12);(only one row) and/oraddRange(months).addRange(range).setTransposeRowsAndColumns(true).setOption("useFirstColumnAsDomain", true)- TheMaster