this example works with:
>>>var query = new
>>>google.visualization.Query('http://spreadsheets.google.com/tq?>>>key=0AoeEjAWWTeE6dFZCaFF6djNVMkk5OFBLVDdQQUFORmc&range=A1:B4&gid=0');
Why this doesnt work with:
>>> var query = new google.visualization.Query('googledata.htm');
with googledata.htm wich contains the same response text ?
ie:
>>>google.visualization.Query.setResponse({version:'0.6',status:'ok',sig:'1446943962',table:
>>>{cols:[{id:'A',label:'A',type:'string',pattern:''},
>>>{id:'B',label:'B',type:'number',pattern:'#0.###############'}],rows:
>>>[{c:[{v:'juju'},{v:3500.0,f:'3500'}]},{c:[{v:'nico'},{v:
>>>1500.0,f:'1500'}]},{c:[{v:'jc'},{v:2500.0,f:'2500'}]}]}});
On 2 juin, 17:39, juju59 <[email protected]> wrote:
> Hi,
> I'm new to this group and trying to make a very simple example of a
> data source Request.
> This code below doesn't work ( the handler is not fired )
> Does anyone have an idea ?
>
> the html:
>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <title>Page sans titre</title>
> <script type="text/javascript" src="http://www.google.com/jsapi"></
> script>
> <script type="text/javascript">
> google.load('visualization', '1', {'packages':['piechart']});
> google.setOnLoadCallback(initialize);
>
> function initialize()
> {
> var query = new
> google.visualization.Query('googledata.htm');
> query.send(myResponseHandler); //note: this neither work
> with handleQueryResponse
> }
>
> function myResponseHandler(response) {
> var data = new
> google.visualization.DataTable(response['table']);
> var chart = new
> google.visualization.PieChart(document.getElementById('chart_div'));
> chart.draw(data, {width: 400, height: 240, is3D: true});
> }
>
> function handleQueryResponse(response)
> {
> var data = response.getDataTable();
> var chart = new
> google.visualization.PieChart(document.getElementById('chart_div'));
> chart.draw(data, {width: 400, height: 240, is3D: true});
> }
> </script>
> </head>
> <body>
> <h1>Pie chart</h1>
> <div id="chart_div"></div>
> </body>
> </html>
>
> the Googledata.htm content (single text file, no header):
> google.visualization.Query.setResponse({version:'0.6',status:'ok',sig:'1446943962',table:
> {cols:[{id:'A',label:'A',type:'string',pattern:''},
> {id:'B',label:'B',type:'number',pattern:'#0.###############'}],rows:
> [{c:[{v:'juju'},{v:3500.0,f:'3500'}]},{c:[{v:'nico'},{v:
> 1500.0,f:'1500'}]},{c:[{v:'jc'},{v:2500.0,f:'2500'}]}]}});
>
> thanks a lot !!!
> juju
--
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.