Thanks that was just the help I needed. I realized I could put the
charting code at a different location pointed to here in frame, i.e.
class SpectrumResults(webapp.RequestHandler):
def post(self):
self.response.out.write('<iframe src=SpectrumChart width="600"
height="400"></iframe>')
class SpectrumChart(webapp.RequestHandler):
def get(self):
mytitle ='"Hello World"'
mydata='t:40,20,50,20,100|80,80,80,80,80'
template_values = {'mytitle': mytitle,
'mydata': mydata}
path = os.path.join(os.path.dirname(__file__), "index.html")
self.response.out.write(template.render(path,
template_values))
On Feb 25, 7:14 pm, dburns <[email protected]> wrote:
> template.render returns you the contents of the template, and you are
> trying to provide that to the src attribute. The src attribute should
> be the LOCATION, not the content.
>
> Seehttp://www.w3schools.com/TAGS/tag_iframe.asp
>
> Should be something like:
> self.response.out.write('<iframe src="myframe" width="600"
> height="400"></iframe>')
>
> (and then your 'myframe' url returns the contents you currently have
> in x).
>
> On Feb 25, 7:49 pm, sjh <[email protected]> wrote:
>
>
>
> > 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.