Hi,
The chart docs show examples of how to automatically load a chart with
javascript or php. However, nothing on how to do it with Google App
Engine. The problem is you need to use templates to add the chart data
and then somehow load the output into a frame but I cannot see how.
Has anyone been able to do a dynamic chart with the google chart api
and GAE?
Here is the GAE 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>')
notice how somehow you need to get x into the frame (no idea how).
Here is the static file which autoloads the page with the chart
<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>
If anyone knows how to do this it would be a great addition to the
chart docs I have been trying for a while now.
Help much appreciated.
Simon
--
You received this message because you are subscribed to the Google Groups
"Google Chart 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-chart-api?hl=en.