Hi Martina, Thanks for posting this! It's very helpful! I'm also trying to use d3 in web2py. I follow your example, it works! But I don't know how to make to circle appear above the copyright 2013 -- powered by web2py line.
Here's the html file: {{response.files.append(URL(r=request,c='static',f='/js/d3.js'))}} {{extend 'layout.html'}} <section id="main" class="main row"> <div class="span12"> <p>Here we would like to have some d3.js plots</p> <script type="text/javascript"> d3.select('body').append('svg').append('circle').style("stroke", "gray").style("fill", "red").attr("r", 40).attr("cx", 50).attr("cy", 50); </script> </div> </sction> What should I add? Thanks!! On Tuesday, January 15, 2013 2:33:48 AM UTC-6, Martina Gruber wrote: > > Alan and Ramos, thnk you for the answers. > Based on your recommendations I did the following: > 1. Created a new app with the wizard (default layout, name: TestD3). > Views: index,error and visualizations where I want to have the d3 stuff. > 2. Put the d3 javascript file in static/js > 3. In View TestD3/views/default/visualizations.html: > > {{response.files.append(URL(r=request,c='static',f='/js/d3.js'))}} > {{extend 'layout.html'}} > > <p>Here we would like to have some d3.js plots</p> > <script type="text/javascript"> > > d3.select('body').append('svg').append('circle').style("stroke", > "gray").style("fill", "red").attr("r", 40).attr("cx", 50).attr("cy", 50); > </script> > > This produced a red circle but the circle below the copyright 2013 -- > powered by web2py line. > Of course I have to select properly because I want to have the circle > inside: > > <section id="main" class="main row"> <div class="span12"> > > > I ll take some time to dive into web2py and then I will post whatever > worked with d3. > > > > -- 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.