Problem: All the documentation I see uses a DataTable that writes the data in the script itself. I need to call this tooltip data from existing rows. I need
in the embedded chart, use a data view definition to add the tooltip role...
see following snippet...
function newChart() {
// Generate a chart representing the data in the range of A1:B15.
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[11];
// build the data view definition
var COLUMN_SPEC = [
0,
1,
{sourceColumn: 2, role: 'tooltip'}
];
var viewSpec = Charts.newDataViewDefinition()
.setColumns(COLUMN_SPEC)
.build();
var chart = sheet.newChart()
.setChartType(Charts.ChartType.SCATTER)
.setDataViewDefinition(viewSpec)
.addRange(sheet.getRange('R3:S5000'))
.addRange(sheet.getRange('Q3:Q5000'))
.setPosition(5, 5, 0, 0)
.build();
sheet.insertChart(chart);
}