There are multiple rows with same label with different data. When the chart renders, I'm seeing same labels more than once with the corresponding data. But what I want is one label and the sum of the data for that label.
I have attached the screenshot. Here is the code:
var ss = SpreadsheetApp.openById('1UzJ20BcH3DaFMeW-gr4wazidqhOtEWCMGEgYTu7-0CI');
var data = ss.getDataRange();
var countryFilter = Charts.newCategoryFilter()
.setAllowMultiple(true)
.setFilterColumnIndex(7)
.setSortValues(true)
.setLabelStacking(Charts.Orientation.VERTICAL)
.setCaption('Choose County')
.build();
var pieChart = Charts.newPieChart()
.setDataViewDefinition(Charts.newDataViewDefinition().setColumns([7,8]))
.setDimensions(600, 500)
.set3D()
.build();
var tableChart = Charts.newTableChart()
.setDataViewDefinition(Charts.newDataViewDefinition().setColumns([7,8]))
.build();
var dashboard = Charts.newDashboardPanel()
.setDataTable(data)
.bind([ countryFilter], [pieChart, tableChart,])
.build();
var app = UiApp.createApplication();
var filterPanel = app.createVerticalPanel();
var chartPanel = app.createHorizontalPanel();
filterPanel.add(countryFilter).setSpacing(10);
chartPanel.add(pieChart).add(tableChart).setSpacing(10);
dashboard.add(app.createVerticalPanel().add(filterPanel).add(chartPanel));
app.add(dashboard);
return app;
}
Tried searching old posts but couldn't find what I want. Any help would be much appreciated.