Hi
The Query API is designed to fetch multiple queries and so each outgoing
request is assigned an ID. The data source responding to the request assigns
the same ID to its response. In your case your data source is static and so
it can not assign a dynamic ID. The simplest way to overcome this obstacle
is to use a custom response Handler instead of of the default
google.visualization.Query.setResponse().
Note that this is tailored to your specific static response case and may
fail in other scenarios.

function myResponseHandler(response) {
  var data = new google.visualization.DataTable(response['table']);
  return data;
}

HTH

ChartMan

On Fri, Aug 28, 2009 at 8:44 PM, aerosmile <[email protected]> wrote:

>
> Hi,
>
> I am trying to feed my annotated graph with a data table generated by
> a separate php file. I thought I should be able to do this by
> generating JSON output in the same format as produced by the
> spreadsheet that was used in this Playground example:
> http://code.google.com/apis/ajax/playground/?type=visualization#ready_event
>
> When I run my code, it works well when it fetches the above URL. As
> soon as I direct it to my php file, it produces the following 2 errors
> in Firebug:
>
> - Missing query for request id: undefined
> - Data Table is not defined
>
> At first I thought it must be something in my code, but then I tried
> to simplify my data table to do nothing else other than just replicate
> the exact same output produced by the spreadsheet above, and this
> still doesn't work. The file I created and its output can be found
> here (same output as in the spreadsheet above):
> http://www.kangoria.com/json.php
>
> At this point, I am starting to think that it must be something about
> the headers or some other information that the spreadsheet above is
> delivering and my file is not. Any thoughts?
>
> Here is the code I used for the file:
>
> <?php
> header("Content-Type: text/plain; charset=UTF-8");
> $string = "google.visualization.Query.setResponse
> ({version:'0.6',status:'ok',sig:'261991901',table:{cols:
> [{id:'A',label:'Release Date',type:'date',pattern:'M/d/yyyy'},
> {id:'B',label:'Budget (in
> dollars)',type:'number',pattern:'#0.###############'},
> {id:'C',label:'Gross revenue (in the
> US)',type:'number',pattern:'#0.###############'},{id:'D',label:'Movie
> name',type:'string',pattern:''}],rows:[{c:[{v:new Date
> (1981,10,6),f:'11/6/1981'},{v:5000000.0,f:'5000000'},{v:
> 4.2365581E7,f:'42365581'},{v:'Time Bandits'}]},{c:[{v:new Date
> (1985,11,18),f:'12/18/1985'},{v:1.5E7,f:'15000000'},{v:
> 9929000.0,f:'9929000'},{v:'Brazil'}]},{c:[{v:new Date
> (1989,2,10),f:'3/10/1989'},{v:2.35E7,f:'23500000'},{v:
> 8000000.0,f:'8000000'},{v:'The Adventures of Baron Munchausen'}]},{c:
> [{v:new Date(1991,8,20),f:'9/20/1991'},{v:2.4E7,f:'24000000'},{v:
> 4.2E7,f:'42000000'},{v:'The Fisher King'}]},{c:[{v:new Date
> (1996,2,29),f:'3/29/1996'},{v:2.9E7,f:'29000000'},{v:
> 5.7141459E7,f:'57141459'},{v:'Twelve Monkeys'}]},{c:[{v:new Date
> (1998,4,22),f:'5/22/1998'},{v:1.85E7,f:'18500000'},{v:
> 1.06E7,f:'10600000'},{v:'Fear and Loathing in Las Vegas'}]},{c:[{v:new
> Date(2005,7,26),f:'8/26/2005'},{v:8.0E7,f:'80000000'},{v:
> 3.7899638E7,f:'37899638'},{v:'The Brothers Grimm'}]}]}});";
> echo $string;
> ?>
>
> Thanks!
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to