Using the CategoryFilter

141 views
Skip to first unread message

API Developer

unread,
Aug 16, 2012, 3:05:40 PM8/16/12
to google-visua...@googlegroups.com
Hey guys, 

Do you know if it's required that we use a DataTable when using the categoryFilter? In addition, is there any way to have it without having a dashboard too?
I'm trying to make a wrapper class so I can use the look and functionality of the control with my own implementation on it's statechanged method.

Here's what I'm trying to do:

 var data google.visualization.arrayToDataTable([
    ['Metric''Value'],
    ['CPU' 12],
    ['Memory'20],
    ['Disk'7],
    ['Network'54]
  ]);
  var config {};
  
  var control new google.visualization.ControlWrapper({
    'controlType''CategoryFilter',
    'options'{
      'filterColumnIndex'0,
      'ui'{
        'allowTyping'false,
        'allowMultiple'config.multipleSelections// default is true
        'selectedValuesLayout'config.selectionLayout// default is aside
        'caption'config.caption // default is: 'Choose a value...'
      }
    },
    // Define an initial state, i.e. a set of metrics to be initially selected.
    'state'{'selectedValues'config.initialSelection}
  });
  
  control.setContainerId('control1');
  control.draw(data);

asgallant

unread,
Aug 16, 2012, 3:44:38 PM8/16/12
to google-visua...@googlegroups.com
You can draw controls without using a Dashboard (which might be a relatively new thing...I seem to recall not being able to before).  You do have to have a DataTable (or DataView), though.

API Developer

unread,
Aug 16, 2012, 8:08:28 PM8/16/12
to google-visua...@googlegroups.com
Could you show me an example, as of now I haven't been able to draw one independent of a dashboard.

asgallant

unread,
Aug 16, 2012, 11:11:42 PM8/16/12
to google-visua...@googlegroups.com
Take your example, but add "dataTable: data" to the control's configuration.  When you make the #draw call, do it without passing data.
Reply all
Reply to author
Forward
0 new messages