The column should not be in an array in the filter:

if (v1 != '') {
    rows = rows.concat(data.getFilteredRows([{column: 0, value: v1}]));
}
if (v2 != '') {
    rows = rows.concat(data.getFilteredRows([{column: 0, value: v2}]));
}


On Thursday, June 5, 2014 4:49:15 PM UTC-4, Missy wrote:
>
> Thank you for your response and apology for the delay response. 
>
> I am little stuck on the code below, as its currently throwing a -- 
> > Error: Invalid column index 0. Should be an integer in the range [0-3].
>
> Would i need to implement a separate method for for adding the names 
> values multiple names values to the line chart, also? if so, how? please 
> advice.
>
> Many thanks. 
>
>             // Define a StringFilter control for the 'Name' column
>             var stringFilter = new google.visualization.ControlWrapper({
>                 'controlType': 'StringFilter',
>                 'containerId': 'control1',
>                 'dataTable': data,
>                 'options': {
>                     'filterColumnLabel': columnNames.split(',')[0],
>                     'ui': {
>                         'allowTyping': false,
>                         'allowMultiple': true,
>                         'allowNone': false,
>                         'selectedValuesLayout': 'belowStacked'
>                     }
>                 },
>
>             });
>
>             // Define a StringFilter control for the 'Name' column
>             var stringFilter2 = new google.visualization.ControlWrapper({
>                 'controlType': 'StringFilter',
>                 'containerId': 'control2',
>                 'dataTable': data,
>                 'options': {
>                     'filterColumnLabel': columnNames.split(',')[0],
>                     'ui': {
>                         'allowTyping': false,
>                         'allowMultiple': true,
>                         'allowNone': false,
>                         'selectedValuesLayout': 'belowStacked'
>                     }
>                 },
>
>             });
>
>             var dateFormatter = new google.visualization.DateFormat({ 
> pattern: 'dd MM yyyy' });
>             var line = new google.visualization.ChartWrapper({
>                 'chartType': 'LineChart',
>                 'containerId': 'PieChartContainer',
>                 'dataTable': data,
>                 'options': {
>                     'width': 960,
>                     'height': 450,
>                     'legend': 'right',
>                     'title': chartTitle,
>                     'chartArea': { 'left': 100, 'top': 100, 'right': 0, 
> 'bottom': 100 },
>                     'pieSliceText': 'label',
>                     'tooltip': { 'text': 'percentage' }
>                 },
>                 'view': { 'columns': [0, 1] }
>             });
>
>             var table = new google.visualization.ChartWrapper({
>                 'chartType': 'Table',
>                 'containerId': 'TableContainer',
>                 'dataTable': data,
>                 'options': {
>                     'width': '900px'
>                   
>                 }
>             });
>
>             function getUniqueIndices (a) {
>                 var ret = [];
>                 for (var i = 0; i < a.length; i++) {
>                     if (ret.indexOf(a[i]) == -1) {
>                         ret.push(a[i]);
>                     }
>                 }
>                 return ret;
>             }
>
>             function update () {
>                 var v1 = stringFilter.getState().value;
>                 var v2 = stringFilter2.getState().value;
>                 var rows = [];
>                 if (v1 != '') {
>                     rows = rows.concat(data.getFilteredRows([{column: 
> [0]/* column index to filter on */, value: v1}]));
>                 }
>                 if (v2 != '') {
>                     rows = rows.concat(data.getFilteredRows([{column: 
> [0]/* column index to filter on */, value: v2}]));
>                 }
>                 var view = line.getView() || {};
>                 view.rows = (v1 == '' && v2 == '') ? null : rows;
>                 line.setView(view);
>                 line.draw();
>             }
>
>             google.visualization.events.addListener(stringFilter, 
> 'statechange', update);
>             google.visualization.events.addListener(stringFilter2, 
> 'statechange', update);
>
>             stringFilter.draw();
>             stringFilter2.draw();
>             line.draw();
>
>         }
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to