I've found two jQuery charts plugins I like - flot and jqPlot. I'm thinking of using one of these on the front-end of my web site.
However, I also need to be able to allow users to export data in PDF format. I'm ideally looking for a pure Python solution, but could run to Java or PHP at a push. The quality of the generated charts is the most important factor.
Options I've considered are:
What would be the best way of doing this? If I can get the Rhino solution to work that'd be great since it'd maintain consistency between the front-end and generated PDFs.
As far as I understand it, flot draws to the canvas element (where available). I googled for examples of exporting the canvas content and found canvas2image, for example. It might, or might not, be an avenue to explore.
See this StackOverflow question too. Going from that one, it might be quite simple to export an image (using Canvas.ToDataUrl(type)
which takes a mime type. I am quite sure it will not do anything meaningful with application/pdf though...).
Update: Well, look here, a modified version of canvas2image resides in the flotr source: http://flotr.googlecode.com/svn/trunk/flotr/flotr/prototype/lib/canvas2image.js
There are solutions to generate PDF from within JavaScript on the client:
Combine these two and you might have a solution.
I suggest to take another look at matplotlib.
The charts are highly customizable and can look very polished. Granted, the many options can be intimidating at first. But a lot of eye-candy effects can be achieved if you know how.
If you want shadows, for instance, take a look at the transforms tutorial.
Furthermore, matplotlib gives you high dpi bitmap images or even PDF vector graphics. I don't know how hard it is to use the mentioned jQuery libraries for higher resolution graphics.
You can run a headless webkit (rendering engine) with Python and Qt on a server which you can then print to PDF. The changes you need to make to print a PDF with Qt are listed here albeit they might not be complete.
This solution will just render the page and you could store the charts as separate images or go the proposed path of generating a full PDF of the page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With