New Nikola Feature: SVG Charts via Pygal
I can't sleep, so I just whipped together a docutils directive that wraps pygal for Nikola, my static site and blog generator.
So, how do you use it? LIke this:
.. chart:: Bar :title: 'Browser usage evolution (in %)' :x_labels: ["2002", "2003", "2004", "2005", "2006", "2007"] 'Firefox', [None, None, 0, 16.6, 25, 31] 'Chrome', [None, None, None, None, None, None] 'IE', [85.8, 84.6, 84.7, 74.5, 66, 58.6] 'Others', [14.2, 15.4, 15.3, 8.9, 9, 10.4]
Which produces this:
You can customize the output a lot, because Pygal is very configurable, and it supports a very wide variety of charts.
Also, the charts are somewhat interactive, which is nice.
It's a pathetically simplistic piece of code but it seems to work well :-)
I see the charts ok in LateralOpinion but as a raw text in planet.python.org.
It not made at all to planeta.python.org.ar (same as last posts in LateralOpinion)
That's a bug in planet I guess. Inline SVGs are valid HTML :-(
Ok, time to unhack planet python I guess.
Really great feature... I did not know about pygal, interesting project...
The implementation is clear and simple... I will test it more deeply soon.
BTW, nice hack for a free night! ;-)