I have created a Table Chart according to Google's Visualization API and published the web app here. The data source is a Google Spreadsheet with Google Form responses. A couple columns contain a list of comma separated values, which are responses of the form's Checklist items. I have applied a "CategoryFilter" to these columns. However, instead of individualizing each comma separated value it treats it as one value.
Image of CSV Values not Separated
I would like for the filter to separate the values based on the comma and then stack them in a dropdown list. Is there a way to do this?
I have tried creating the values according to the API for the values for the "Grade Level(s)" filter, but when I choose one of the values in the filter it finds no result (I assume because the CategoryFilter does not do partial matches).
var gradeLevels = ['K-2','3-5'];
var GradeLevelCategoryFilter = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'GradeLevelCategoryFilter',
'options': {
'filterColumnIndex': '11',
'matchType': 'any',
'allowTyping': true,
'values' : gradeLevels,
'ui': {
'labelStacking': 'horizontal',
'label': '',
'caption' : 'Filter by Grade Level(s)',
'selectedValuesLayout': 'aside',
'sortValues' : false,
}
}
});
when the spreadsheet loads,
use data table method
getDistinctValues(index)
on the columnthis will return a distinct list of the column values
then split each value on comma and build a unique list of the choices
use the choices for the
values
option on the filterthen on the filter's
'statechange'
event,use data table method
getFilteredRows()
to find the row indexeswhich contain the filter's selected choice(s)
use the row indexes to set a view on the chart
see following working snippet, a table chart is used...
EDIT
you can set the view on the initial definition...
or use the
setView
method...EDIT 2
EDIT 3
you can combine multiple filters into an array,
before passing to
getFilteredRows