The required interface for Controls is probably something we should
document.

The optional 3rd argument for the draw() method is for the state.  Since it
is not documented, I am not confident it works reliably.

The applyFilter() method (or just 'apply', no arguments) should return a
DataView that is generated from the incoming data.  Do whatever the
appropriate filter actions are when generating the DataView.  It can throw
an error if something goes wrong.  The applyFilter() will be called when
there is a change of incoming data, or you can indirectly get it called
when there is a change in your UI by triggering a 'ready' event.

The dispose() method will be called when the control itself is being
disposed.  Controls inherit from the Google Closure Disposable class, which
you read about here:
http://docs.closure-library.googlecode.com/git/class_goog_Disposable.html
 Use it to clean up anything that won't clean up itself, such as event
handlers bound to DOM elements.  I'm not 100% sure, but I believe this is
basically an automatically called clear() method.

Sergey has written a great little example that implements a new filter by
using a PieChart as the UI: http://jsfiddle.net/6NeKr/
He only implemented draw and apply.  A key requirement is that when there
is a change in your UI, you need to fire a ready event, which the dashboard
with catch to propagate changes:

        // Notify the dashboard that we're ready.
        google.visualization.events.trigger(me, 'ready', {});

No other event handling is required beyond this.

Hope this helps.



On Thu, Mar 13, 2014 at 3:16 PM, asgallant <[email protected]>wrote:

> I'm looking to build my own control for use in a Dashboard, and I'm trying
> to figure out exactly what I need to support.  From what I have reverse
> engineered, I can tell that I need these methods:
>
> #applyFilter
> #clear
> #dispose
> #draw
> #getState
> #isDisposed
> #resetControl
> #setState
>
> #clear, #getState, #isDisposed, #resetControl, and #setState are
> straightforward.  #draw is mostly straightforward, but I see some
> controls implement a 3rd parameter - what is this for?  What do
> #applyFilter and #dispose do, what are their parameters (if any), and
> what (if anything) do they return?  Are there any methods I left off the
> list that the control must support?
>
> For events, most controls support at least "error", "ready", and
> "statechange".  Are there any behind-the-scenes events that must be
> supported as well?
>
> --
> 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.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>  -
978-394-1058
[email protected] <[email protected]>   5CC, Cambridge MA
[email protected] <[email protected]> 9 Juniper Ridge
Road, Acton MA

-- 
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