Scatter Chart
Scatter charts are used to show trends in data. They are especially useful when you have a large number of data points. Like line charts, they can be used to plot data recorded from scientific experiments, such as how a chemical reacts to changing temperature or atmospheric pressure.
Here is an example of Scatter Chart which takes data from spreadsheet to build the chart.
References:
Chart Preview Screenshot:
Spreadsheet Preview screenshot:
Here is the is the spreadsheet preview which serves as the data source for the chart.
Example Code:
function doGet(){
//Get the data from spreadsheet
ssID ='SpreadsheetID'//Change it to yours
var SS = SpreadsheetApp.openById('ssID');
var sheet = SS.getSheets()[0];
var data = sheet.getRange('A1:B10').getValues();
//Build data table
var dataTable = Charts.newDataTable();
dataTable.addColumn(Charts.ColumnType.NUMBER, data[0][0]);
dataTable.addColumn(Charts.ColumnType.NUMBER, data[0][1]);
//Add rows
for(var j=1; j<data.length; j++){
dataTable.addRow(data[j]);
}
//Create and build chart
var chart = Charts.newScatterChart()
.setDataTable(dataTable)
.setXAxisTitle('Particulate')
.setYAxisTitle('Rainfall')
.setYAxisRange(0, 140)
.setTitle("Particulate levels in Rainfall")
.build();
var app = UiApp.createApplication().setTitle("AST Chart");
app.add(chart)
return app;
}