I'm trying to build a google charts dashboard with apps scripts.
Essentially, I have 3 data sources across 3 google spreadsheets, and wish to create a single dsahboard showing 3 seperate charts (each chart sourced by its own data sheet).
My current script is beneath where I refer to only one data source: var ss = SpreadsheetApp.openById('0AgQXvGX4FXy6dGRrOEZ3djY0M3dIUTNoQkV4TS00MEE')
Ultimately, i'd like to use one source for the tableChart, another for the ColumnChart and one LineChart.
How can this be achieved?
function doGet() {
var ss = SpreadsheetApp.openById('0AgQXvGX4FXy6dGRrOEZ3djY0M3dIUTNoQkV4TS00MEE')
var data = ss.getDataRange();
var InstallDateFilter = Charts.newCategoryFilter()
.setFilterColumnIndex(0)
.setAllowMultiple(false)
.build();
var PlatformFilter = Charts.newCategoryFilter()
.setFilterColumnIndex(1)
.build();
var tableChart = Charts.newTableChart()
.setDimensions(600, 1000)
.enablePaging(30)
.setDataViewDefinition(Charts.newDataViewDefinition()
.setColumns([0,1,2,3,4]))
.build();
var ColumnChart = Charts.newColumnChart()
.setDimensions(600, 600)
.setColors(["green", "red"])
.setTitle('Installs')
.setXAxisTitle('Platform')
.setDataViewDefinition(Charts.newDataViewDefinition()
.setColumns([1,4]))
.setLegendPosition(Charts.Position.BOTTOM)
.build();
var LineChart = Charts.newLineChart()
.setDimensions(1000, 600)
.setTitle('ARPI')
.setXAxisTitle('InstallDate')
.setDataViewDefinition(Charts.newDataViewDefinition()
.setColumns([0,2]))
.setCurveStyle(Charts.CurveStyle.SMOOTH)
.setPointStyle(Charts.PointStyle.MEDIUM)
.setLegendPosition(Charts.Position.BOTTOM)
.build();
var dashboard = Charts.newDashboardPanel()
.setDataTable(data)
.bind ( [InstallDateFilter, PlatformFilter], [tableChart] )
.bind ( [InstallDateFilter, PlatformFilter], [ColumnChart] )
.bind ( [InstallDateFilter, PlatformFilter], [LineChart] )
.build();
var app = UiApp.createApplication();
var filterPanel = app.createVerticalPanel();
var chartPanel = app.createHorizontalPanel();
filterPanel.add(InstallDateFilter) .add(PlatformFilter).setSpacing(10);
chartPanel .add(tableChart) .add(ColumnChart) .add(LineChart) .setSpacing(10);
dashboard.add(app.createHorizontalPanel()
.add(filterPanel).add(chartPanel));
app.add(dashboard);
return app;
}