One thing it does is generate svg content. I would like to be able to generate a png image from the svg definition, but on the server. I know it's possible with phantom.js and node.js (from another group: https://groups.google.com/forum/m/?fromgroups#!topic/d3-js/XHbidy5pY8A), but I'm not sure if they fit into a web2py context, or if that is the right approach with web2py. Does something like a "Headless web kit browser" fit into web2py approach?
.
I'm wondering is it possible, using something like response.render to generate the svg in a controller and generate a png image (which I could save or include in PDF output). Would I include these other libraries, but where, in the view?
Anyway, I think d3 is fantastic and it would be great to be able to exploit it (more!) in web2py. Happy to put up some simple examples that show how to do it (the browser part at least)
Thanks
Hi Andrew,
I'm currently looking for a good data vis toolkit for web2py. Currently we are plotting things with matplotlib in the background and display the generated PNGs, but that feels rather awkward and is not interactive (ok, I could generate SVGs and fiddle with them using StringIO and XML parsing, but that seems to convoluted to me).
Since my MS Office using clientele can't deal with SVGs, I'm very interested in how the PNG conversion issue turns out.
Coming back to your offer, could you perhaps post a simple example on how to integrate web2py and d3.js? For now I'm particularly interested in the ingenious barcharts example on http://mbostock.github.com/d3/ex/stack.html - how do I replace the faux data generation functions with a web2py controller passing a data array?
Thanks,
Martin