There are two things here:
1) your container div has an ID of "visualization1", but your table is
targetting a div with an ID of "visualization"; the id used to draw the
table must match a div element in you HTML.
2) you have to set up the query correctly for fusion tables. Take the
docid from the fusion tables url, and use that in a "FROM" clause in the
select statement. You also need to change the query url to the appropriate
one for visualization queries:
var query = new
google.visualization.Query('http://www.google.com/fusiontables/gvizdata?tq=');
query.setQuery('SELECT * FROM 1xmjxPPQOoFuDf4RsqjxROelUzAIw3lRFtoNSxgI');
Make those changes and it should work.
On Monday, February 25, 2013 8:10:57 AM UTC-5, Tangred wrote:
>
> Hello,
>
> It's been a while i try to fond the solution whithout result. I would like
> to load a table from fusion, using some query functions and return the
> resultat on a table / chart whatever. I copy paste the code from Google dev
> but that doesn't work properly.
>
> he it is :
> *
> *
> *<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">*
> *<html xmlns="http://www.w3.org/1999/xhtml">*
> * <head>*
> * <meta http-equiv="content-type" content="text/html;
> charset=utf-8"/>*
> * <title>*
> * Google Visualization API*
> * </title>*
> * <script type="text/javascript" src="http://www.google.com/jsapi
> "></script>*
> * <script type="text/javascript" src="
> http://code.jquery.com/jquery-1.9.1.min.js"></script>*
> * <script type="text/javascript">*
> * google.load('visualization', '1', {packages: ['table']});*
> * </script>*
> * <script type="text/javascript">*
> *
> *
> * *
> *
> *
> * google.setOnLoadCallback(drawVisualization);*
> * function drawVisualization() {*
> * *
> * *
> * var query = new google.visualization.Query(*
> * '
> https://www.google.com/fusiontables/DataSource?docid=1xmjxPPQOoFuDf4RsqjxROelUzAIw3lRFtoNSxgI'
> );*
> *
> *
> * // Send the query with a callback function.*
> * query.send(handleQueryResponse);*
> *
> *
> * }*
> *
> *
> *function handleQueryResponse(response) {*
> *
> *
> * if (response.isError()) {*
> * alert('Error in query: ' + response.getMessage() + ' ' +
> response.getDetailedMessage());*
> * return;*
> * }*
> *
> *
> * var data = response.getDataTable();*
> *
> *
> * visualization = new
> google.visualization.Table(document.getElementById('visualization'));*
> *
> *
> * visualization.draw(data, null);*
> *
> *
> *}*
> *
> *
> *
> *
> *
> *
> * //google.setOnLoadCallback(initialize);*
> * </script>*
> * </head>*
> * <body>*
> * <div>*
> * <div id="visualization1" />*
> * </div>*
> * *
> * </body>*
> *</html>*
>
> the error i have in the console :
>
> Resource interpreted as Script but transferred with MIME type text/html
>
>
> Do you have any idea why ?
>
> Regards
>
--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.