Hi
I am having a nightmare of a time trying to figure out how to get the
google chart api to work with GAE. I can use a template to generate my
chart but I need to put that output into a a frame and I am stuck.
Here is the call:
def post(self):
mytitle ='"Hello World"'
mydata='t:40,20,50,20,100|10,10,10,10,10'
template_values = {'mytitle': mytitle,
'mydata': mydata}
path = os.path.join(os.path.dirname(__file__), "index.html")
x=template.render(path, template_values)
self.response.out.write('<iframe src="x" width="600"
height="400"></iframe>')
X -- marks where I am stuck
Here is the template (index.html)
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /
>
<script type='application/javascript'>
// Send the POST when the page is loaded,
// which will replace this whole page with the retrieved chart.
function loadGraph() {
var frm = document.getElementById('post_form');
if (frm) {
frm.submit();
}
}
</script>
</head>
<body onload="loadGraph()">
<form action='http://chart.apis.google.com/chart' method='POST'
id='post_form'>
<input type="hidden" name="cht" value="s" />
<input type="hidden" name="chtt" value={{ mytitle }} />
<input type='hidden' name='chs' value='600x400' />
<input type="hidden" name="chxt" value="x,y" />
<input type='hidden' name='chd' value={{ mydata }} />
<input type="submit" value='show plot'/>
</form>
</html>
Any suggestions would be much appreciated.
thanks, Simon
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" 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-appengine?hl=en.