alwave9
unread,Jan 11, 2012, 9:34:57 AM1/11/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Visualization API
Hi,
I am trying to use Google Visualization APIs on my Google Site web
page to query and visualize data stored in Google spreadsheets. I am
not sure what is the best way to do it: create a gadget (I am not very
familiar how to do it) or use Apps Script module and then insert the
script into the page.
When I try to use Google Visualization API (I copied some sample code
form Google Visualization Playground samples and pasted into Apps
Script Editor), I get this error:
ReferenceError: "google" is not defined. (line 3)
this the sample code
function drawVisualization() {
// Create and populate the data table.
var data = new google.visualization.DataTable(); - this is the line
3
data.addColumn('string', 'Task');
data.addColumn('number', 'Hours per Day');
data.addRows(5);
data.setValue(0, 0, 'Work');
data.setValue(0, 1, 11);
data.setValue(1, 0, 'Eat');
data.setValue(1, 1, 2);
data.setValue(2, 0, 'Commute');
data.setValue(2, 1, 2);
data.setValue(3, 0, 'Watch TV');
data.setValue(3, 1, 2);
data.setValue(4, 0, 'Sleep');
data.setValue(4, 1, 7);
// Create and draw the visualization.
new
google.visualization.PieChart(document.getElementById('visualization')).
draw(data, {title:"So, how was your day?"});
}
Could you kindly help me to understand how to use Visualization APIs
in the Google Sites page? If gadgets is the only way to do it then I
will learn how to do it, but if there is another way besides the
gadget creation, please let me know. I have been able to create a
stand alone html page which loads and uses the Visualization APIs, but
Google Sites does not allow to upload html pages, and I need to
somehow insert my code into Google Site page.
Maybe there is a way to load Visualization API into apps script
editor? Unfortunately cannot find how to do it.
Thank you
Liya