On May 29, 12:04 pm, "VizGuy (Google)" <
viz...@google.com> wrote:
> Today's launch addresses this most popular request. We added an option
> to create a DataTable locally on the client (in JavaScript). You can
> bring the data from anywhere you have it, convert it into a common
> DataTable class, and run visualizations on top of that.
>
That phrase ' bring the data from anywhere you have it' would take
place in the javascript
right? The we would populate a javascript DataTable and poke it into
the visualization.
That's cool but....
I'm still leaning towards writing a DataSource. Remember how we
reverse engineered the
JSON format of the 'old time series gadget'? For example:
google.visualization.Query.setResponse({table:{rows:[[{v:new
Date(1981,10,6),f:'11/6/1981'},{v:5000000.0,f:'5000000'},{v:
4.2365581E7,f:'42365581'},{v:'Time Bandits'}],[{v:new
Date(1982,10,6),f:'11\/6\/1982'},{v:6000000.0,f:'6000000'},{v:
5.2365581E7,f:'52365581'},{v:''}],[{v:new
Date(1983,10,6),f:'11/6/1981'},{v:7000000.0,f:'7000000'},{v:
1.2365581E7,f:'12365581'},{v:'Brazil'}]],cols:
[{id:'A',label:'Date',type:'d',pattern:'M\/d\/yyyy'},
{id:'B',label:'Budget',type:'n',pattern:'#0.###############'},
{id:'C',label:'Revenue',type:'n',pattern:'#0.###############'},
{id:'D',label:'Movie',type:'t',pattern:''}]},requestId:'0',status:'ok',signature:'6173382439516707022'})
This works fine when you spit this out as a response from a GAE page,
that you specify
as the 'data source URL' in the time series gadget.
But have you noticed that this format does *not* work for
google.visualization.AnnotatedTimeLine?
For example, I tried this javascrpt:
function fetchData() {
var dataurl='http://<name omitted>.
appspot.com/JSON';
var query = new google.visualization.Query(dataurl);
query.send(handleQueryResponse); // Send the query with a
callback function
}
function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' +
response.getDetailedMessage());
return;
}
var data = response.getDataTable();
var chart = new
google.visualization.AnnotatedTimeLine(document.getElementById('chart_div'));
chart.draw(data, {displayAnnotations: false});
}
Up comes the annotaed time series chart, I see Budget data plotted
properly, but the Revenue
data and the Movie annotations are absent.
Does the new annotated visualization expect a different JSON format?
Wouldn't it be totally sweet if we had a *Python* DataTable object
that we populated in GAE
and then serialized it out in response to a visualization query from
our javascript!!!!
Am I re-inventing the wheel here? It sure feels like it.
Cheers,
David