On Friday, March 11, 2016 at 9:21:47 AM UTC-8, Ramos wrote:
>
>
> Forget that view associated with graph function.
>
> you need a different view and controller.
> For example controllerA and viewA
>
> def controllerA():
>
>     return dict(your_vars_here...)
>

Note that this is returning a dict (standard Web2Py stuff), and that dict 
can have the graph ('graph' = graph()) and the headline ('headline' = "My 
first Graph").


> viewA.html
> here should paste the content of your previous view.
> This way you will have the graph and 
> <h1> MY FIRST GRAPH </h1>
>
>
And this would  become 
<h1> {{=headline}}</h1>


/dps


2016-03-10 16:01 GMT+00:00 <[email protected] <javascript:>>:

> Hi Guys, 
>
> Trying to draw some graphs using pygal and below link:
>
> http://www.web2pyslices.com/slice/show/1634/beauty-graphics-and-charts-with-pygal
>
> It works fine, but my view display only graph, without anything else 
> included in the view e.g. headers, styling etc.
>
> Controller:
>
> def graph():
>         response.view = 'default/graph.html'
>         response.headers['Content-Type']='image/svg+xml'
>         dateline = pygal.DateLine(x_label_rotation=25)
>         dateline.x_labels = [
>         datetime.date(2013, 1, 1),
>         datetime.date(2013, 7, 1),
>         datetime.date(2014, 1, 1),
>         datetime.date(2014, 7, 1),
>         datetime.date(2015, 1, 1),
>         datetime.date(2015, 7, 1)
>         ]
>
>
>         dateline.add("Serie", [
>         (datetime.date(2013, 1, 2), 213),
>         (datetime.date(2013, 8, 2), 281),
>         (datetime.date(2014, 12, 7), 198),
>         (datetime.date(2015, 3, 21), 120)
>         ])
>         
>         return dateline.render()
>
>
> view:
>
> {{extend 'layout.html'}}
>
>
> <h1>MY FIRST GRAPH</h1>
>
>
> <embed src="http://localhost/project/default/graph.svg"; type="image/svg+
> xml" />
>
>
> How can i disply my original view containing styles from layout.html, 
> header "MY FIRST GRAPH" and the graph itself? 
>
> 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 [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to