Thanks again. I have this working. For anyone interested in doing the same 
for an annotated timeline this is what I have done:

function handleQueryResponse(response) {
    if (response.isError()) {
      alert('Error in query: ' + response.getMessage() + ' ' + 
response.getDetailedMessage());
      return;
    }
    var data = response.getDataTable();
    var headerView = new google.visualization.DataView(data);
    headerView.hideColumns([0]);
    var custs = new Array();
    for (var i = 0; i < headerView.getNumberOfColumns(); i++) {
        custs.push(headerView.getColumnLabel(i));
    }

    var categoryPicker = new google.visualization.ControlWrapper({
    'controlType': 'CategoryFilter',
    'containerId': 'control1',
    'options': {
      'filterColumnIndex': 0,
      'values': custs,
      'ui': {
        'allowMultiple': true,
        'selectedValuesLayout': 'belowStackeD'
      }
    },
    // Define an initial state, i.e. a set of metrics to be initially 
selected.
    'state': {'selectedValues': ['XXXXI']},
    'dataTable': data
  });

  var timeChart = new google.visualization.ChartWrapper({
    'chartType': 'AnnotatedTimeLine',
    'containerId': 'timechart_div',
    'dataTable': data
  });


  function onControlStateChange() {
       var filterCusts = [0];
       var columns = categoryPicker.getState();
       console.log(columns);
       for (var i = 0; i < columns.selectedValues.length; i++) {
           for (var j = 0; j < data.getNumberOfColumns(); j++) {
               console.log(data.getColumnLabel(j));
               console.log(columns.selectedValues[i]);
               if (data.getColumnLabel(j) == columns.selectedValues[i]) {
                   filterCusts.push(j);
               }
           }
       }
       console.log(filterCusts);
       timeChart.setView({'columns': filterCusts});
       timeChart.draw();
   }

   google.visualization.events.addListener(categoryPicker, 'statechange', 
onControlStateChange);

   timeChart.draw();
   categoryPicker.draw();

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/w0KLm-sxQgcJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to