Let me countercheck. On Fri, 21 Dec 2018, 12:32 sandeep patel <patelsandeep...@gmail.com wrote:
> @Maurice > This code is working good. you can check here > <http://13.127.38.120/PayUmoney/default/test#>. > It would be easy to inspect the problem if you can show your controller > code what you have written. > > Thanks > > > On Fri, Dec 21, 2018 at 1:55 PM Maurice Waka <mauricew...@gmail.com> > wrote: > >> Hello Sandeep, >> The form appears well, but the chart area doesn't show any chart, looks a >> small box at the top left side of the page. >> Trying to show it shows a message: 'insufficient privileges'. >> Regards >> >> On Fri, Dec 21, 2018 at 9:58 AM sandeep patel <patelsandeep...@gmail.com> >> wrote: >> >>> You can achieve this way. >>> Controller.py >>> import pygal >>> def chart(): >>> >>> response.files.append(URL('default','static/js/pygal-tooltips.min.js')) >>> response.headers['Content-Type']='image/svg+xml' >>> import pygal >>> from pygal.style import Style >>> >>> custom_style = Style( >>> background='transparent', >>> plot_background='transparent', >>> foreground='#53E89B', >>> foreground_strong='#53A0E8', >>> foreground_subtle='#630C0D', >>> opacity='.6', >>> opacity_hover='.9', >>> transition='400ms ease-in', >>> colors=('#E853A0', '#E8537A', '#E95355', '#E87653', '#E89B53') >>> ) >>> >>> chart = pygal.StackedLine(fill=True, interpolate='cubic', >>> style=custom_style, ) >>> >>> * data = db(db. my_tracker).select() chart.add('A', [i.weight for >>> i in data])* >>> return chart.render() >>> >>> def index(): >>> chart= URL('default', 'chart') >>> form = SQLFORM(db.my_tracker, submit_button=T('Submit')).process() >>> form.element('input[name=weight]')['_style']='width:60px;height:30px;' >>> return dict(chart = chart,form=form) >>> >>> #View/index.html >>> >>> {{extend 'layout.html'}} >>> <figure> >>> <embed type="image/svg+xml" src="{{=chart}}" /> >>> </figure> >>> >>> <h1>{{=form}}</h1> >>> >>> You can change style according to your convenience >>> >>> >>> Thanks >>> SP >>> >>> >>> >>> On Fri, Dec 21, 2018 at 7:23 AM Maurice Waka <mauricew...@gmail.com> >>> wrote: >>> >>>> I've come across this >>>> <http://www.web2pyslices.com/slice/show/1634/beauty-graphics-and-charts-with-pygal-updated> >>>> site >>>> where one can create charts and graphs. >>>> However I have a challenge of using the database as I don't know how to >>>> link to it. For example, i want to track a variable like weight. The user >>>> inputs the values on a regular basis with the trend showing on the graph. >>>> How do I connect to the database and track it daily? >>>> So far, my code is this: >>>> model >>>> db.define_table('my_tracker', >>>> Field('weight','double',), >>>> Field('created_by','reference auth_user',default = auth >>>> .user_id, readable = False, writable = False)) >>>> >>>> Controller: >>>> row = db(db.tracker.created_by == auth.user_id).select().first() >>>> if not row: >>>> form = SQLFORM(db.my_tracker, submit_button=T('Submit')) >>>> form.element('input[name=weight]')['_style']= >>>> 'width:60px;height:30px;' >>>> >>>> -- >>>> 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. >>>> >>> -- >>> 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 a topic in the >>> Google Groups "web2py-users" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/web2py/dGkepqrPY0g/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> web2py+unsubscr...@googlegroups.com. >>> 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 web2py+unsubscr...@googlegroups.com. >> 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 web2py+unsubscr...@googlegroups.com. > 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.