Thanks again Ricardo, my code has now developed after what you have
suggested, but i still seem to get an error response, apologies for
bothering you with this again,
Do I have to specify the columns to base it on.
thanks again
:
<!--
You are free to copy and use this sample in accordance with the terms
of the
Apache license (
http://www.apache.org/licenses/LICENSE-2.0.html)
-->
<!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 Sample
</title>
<script type="text/javascript" src="
http://www.google.com/jsapi"></
script>
<script type="text/javascript">
google.load('visualization', '1.1', {packages: ['controls']});
</script>
<script type="text/javascript">
google.setOnLoadCallback(drawVisualization);
function drawVisualization() {
// Visualization API is loaded, fetch data from spreadsheet.
var query = new google.visualization.Query('THIS IS THE
SPREADSHEET URL');
query.send(handleQueryResponse);
}
function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' +
response.getDetailedMessage());
return;
}
// Fetch was successful, extract datatable
var data = response.getDataTable();
// Define the controls you need
var slider = new google.visualization.ControlWrapper({
'controlType': 'NumberRangeFilter',
'containerId': 'control1',
'options': {
'filterColumnLabel': 'Rate',
'minValue': 0,
'maxValue': 60
}
});
var barChart = new google.visualization.ChartWrapper({
'chartType': 'BarChart',
'containerId': 'chart1',
'options': {
'width': 400,
'height': 300,
'hAxis': {'minValue': 0, 'maxValue': 60},
'chartArea': {top: 0, right: 0, bottom: 0}
}
});
// Define the dashboard and give it the data you retrieved from the
spreadsheet.
new
google.visualization.Dashboard(document.getElementById('dashboard')).
bind(slider, barChart).
draw(data);
}
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="dashboard">
<table>
<tr style='vertical-align: top'>
<td style='width: 300px; font-size: 0.9em;'>
<div id="control1"></div>
<div id="control2"></div>
<div id="control3"></div>
</td>
<td style='width: 600px'>
<div style="float: left;" id="chart1"></div>
<div style="float: left;" id="chart2"></div>
<div style="float: left;" id="chart3"></div>
</td>
</tr>
</table>
</div>
</body>
</html>
On Jun 16, 12:31 am, d d <
aux03s...@gmail.com> wrote:
> thx
>
> 2011/6/15 Riccardo Govoni <
battleho...@gmail.com>
>
>
>
>
>
>
>
> > There is some confusion in your script. The sequence of events should be:
>
> > google.setOnLoadCallback(drawVisualization);
>
> > function drawVisualization() {
> > // Visualization API is loaded, fetch data from spreadsheet.
> > var query = new google.visualization.Query(
> > 'THIS IS MY GOOGLE SPREADSHEET URL');
>
> > query.send(handleQueryResponse);
> > }
>
> > function handleQueryResponse(response) {
> > if (response.isError()) {
> > // handle Error
> > }
> > // Fetch was successful, extract datatable
> > var data = response.getDataTable();
>
> > // Define the controls you need
> > var slider = new google.visualization.ControlWrapper({
> > // ...
> > });
>
> > var barChart = new google.visualization.ChartWrapper({
> > // ...
> > }
>
> > // Define the dashboard and give it the data you retrieved from the
> > spreadsheet.
> > new google.visualization.Dashboard(document.getElementById('dashboard')).
> > bind(slider, barChart).
> > draw(data);
> > }
>
> > As you see, you specify your spreadsheet url only once, fetch the data from
> > it via Query and then proceed as in the simple dashboard example<
http://code.google.com/apis/ajax/playground/?type=visualization#simpl...>in assembling the dashboard.