I don't know why they did the Playground example like that - it's not a good idea. Given that DataTables are a subset of the Visualization API, which definitely doesn't get loaded prior to the google.load() call, then they must be counting on users either a) getting lucky or b) having the API precached. As a general rule of thumb, you shouldn't rely on either being true.
On Tuesday, March 27, 2012 1:14:07 PM UTC-4, NA wrote: > > > Thanks for diting the example. > > Interesting you mentioned creating the DataTable object before the script > finishes. That's actually how the Google Visualization Playground is > written - if you visit > http://code.google.com/apis/ajax/playground/?type=visualization#sort_eventand > click "Edit HTML" you'll see they're creating the DataTable outside of > the script loading callback. > > Is that because the DataTable is loaded in the js.api script (included > before the code)? Or is it because in the Playground they load the Google > apis ahead of time anyway? Or are they just getting lucky? > > If it's not the first, GVIZ should probably update the example code to > something safer. That could be why I've seen others having problems when > they execute library calls before the library loaded; they might be > following this model. > > Secondly, it does seem like a new chart is created. Hooking into the > wrapper's "ready" event seems like the best way to add events. The "ready" > event is with the Wrapper, which isn't recreated, but the "sort" event is > with the chart, which is deleted each time the chart is redrawn. Makes > sense. > > thanks, > > > -- 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/-/YUF4_Ky-hhkJ. 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.
