tried with
return dict(form=form,chart=chart)
?

Il giorno mercoledì 20 gennaio 2016 14:47:16 UTC+1, kecajk...@gmail.com ha 
scritto:
>
> Hi Guys, 
>
> I try to use pygal to draw some charts and it works fine. I used example 
> from:
>
>
> http://www.web2pyslices.com/slice/show/1634/beauty-graphics-and-charts-with-pygal
>
> However i don't know how to display SQL.form and pygal chart in one view.
>
> My code 
>
>
> def form_and_chart():
>      chart = plot_pygal()
>      form = SQLFORM.factory( Field('time') )
>      return dict(form=form),chart
>
>
> def plot_pygal():
>  response.headers['Content-Type']='image/svg+xml'
>  bar_chart = pygal.Bar(style=CleanStyle) # Then create a bar graph object
>  bar_chart.add('Fibonacci', [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]) # Add 
> some values 
>  return bar_chart.render()
>
>
> view: form_and_chart.html
>
> {{extend 'layout.html'}}
> {{=form}}
> <embed src="http://localhost/myapp/default/plot_pygal.svg"; type=
> "image/svg+xml" />
>
>
> When i do return(form=form), form is displayed correctly, when i do return 
> chart, chart is displayed correctly. How to combine those two to be 
> displayed on one page?
>
> Thanks!
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to