Charts

If you are using reStructuredText and install pygal, Nikola has support for rather nice charts with little effort, and i’s even semi-interactive (hover your pointer over the legend!):

.. chart:: StackedLine
   :title: 'Browser usage evolution (in %)'
   :fill: True
   :x_labels: ['2002','2003','2004','2005','2006','2007','2008','2009','2010','2011','2012']
   :width: 600
   :height: 400
   :explicit_size: True
   :style: BlueStyle

   ('Others',  [14.2, 15.4, 15.3,  8.9,    9, 10.4,  8.9,  5.8,  6.7,  6.8,  7.5])
   ('IE',      [85.8, 84.6, 84.7, 74.5,   66, 58.6, 54.7, 44.8, 36.2, 26.6, 20.1])
   ('Firefox', [None, None, None, 16.6,   25,   31, 36.4, 45.5, 46.3, 42.8, 37.1])
   ('Chrome',  [None, None, None, None, None, None,    0,  3.9, 10.8, 23.8, 35.3])
Browser usage evolution (in %) 10.020.030.040.050.060.070.080.090.0100.020022003200420052006200720082009201020112012Browser usage evolution (in %)14.28.446153846153846281.0384615384615515.450.676923076923075277.192307692307715.392.9076923076923277.51282051282058.9135.13846153846154298.0256410256419177.36923076923077297.705128205128210.4219.6293.217948717948738.9261.8307692307692298.0256410256415.8304.0615384615384307.961538461538456.7346.2923076923077305.07692307692316.8388.5230769230769304.75641025641037.5430.7538461538461302.5128205128205100.08.4461538461538466.038461538461547100.050.6769230769230756.038461538461547100.092.90769230769236.03846153846154783.4135.1384615384615459.2435897435897275177.3692307692307786.1666666666666969.0219.6105.3974358974359163.6261.8307692307692122.705128205128250.599999999999994304.0615384615384164.371794871794942.900000000000006346.2923076923077189.0512820512820433.4388.5230769230769219.527.6430.7538461538461238.0897435897436100.08.4461538461538466.038461538461547100.050.6769230769230756.038461538461547100.092.90769230769236.038461538461547100.0135.138461538461546.038461538461547100177.369230769230776.038461538461547100.0219.66.038461538461547100.0261.83076923076926.03846153846154796.1304.061538461538418.53846153846154789.2346.292307692307740.6538461538461376.19999999999999388.523076923076982.3205128205128764.7430.7538461538461119.17948717948715100.08.4461538461538466.038461538461547100.050.6769230769230756.038461538461547100.092.90769230769236.038461538461547100.0135.138461538461546.038461538461547100177.369230769230776.038461538461547100.0219.66.038461538461547100.0261.83076923076926.038461538461547100.0304.06153846153846.038461538461547100.0346.29230769230776.03846153846154799.99999999999999388.52307692307696.038461538461604100.0430.75384615384616.038461538461547OthersIEFirefoxChrome

Here’s how it works:

  • Next to the directive, use the chart type you want
  • Any option you can set in a chart? Use it like :title: in this example. Syntax on the value is just like in the pygal examples.
  • For each data series do it like the line that says Firefox in this example. The first element is the label, then comes the data.

Easy, right? Please explore the pygal site for more information, and just take this example and tweak stuff.