Take your example, but add "dataTable: data" to the control's
configuration. When you make the #draw call, do it without passing data.
On Thursday, August 16, 2012 8:08:28 PM UTC-4, API Developer wrote:
>
> Could you show me an example, as of now I haven't been able to draw one
> independent of a dashboard.
>
> On Thursday, August 16, 2012 3:44:38 PM UTC-4, asgallant wrote:
>>
>> 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.
>>
>> On Thursday, August 16, 2012 3:05:40 PM UTC-4, API Developer wrote:
>>>
>>> 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);
>>>
>>
--
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/-/82p65APFlTUJ.
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.