If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!

Requirements

  • cairo with python bindings installed ( python-cairo packet in Debian )
  • testpie name for web2py application

Screenshot

Below how default controller will be drawn in browser:

Cairo output

Download application

Link to download: web2py.app.testpie.w2p


Where code is placed

  • modules/im_pie.py this is module which make main work
  • controllers/default.py here function "pie" is located.
  • views/default/index.html here is a link to pie function

Notes

This is not very well done implementation of pie chart. Written class can draw chart with customizable colors and element sizes. But not all parameters can be setupped. So i think this is good start point for users who is needed to make vector output.

Related slices

Comments (1)

  • Login to post



  • 0
    suiato 15 years ago
    Wonderful :-) I am trying to figure out a class-based plugin scheme for web2py and used 'cairo piechart' to experiment with the scheme. It's in slice 13. I rated your slice with four stars just to leave a space for improvement you mentioned in the future. You may as well rate my slice with a lot of room for improvement I will need ;-) Thanks.

Hosting graciously provided by:
Python Anywhere