Python to generate nice looking SVG graph http://pygal.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

80 lines
1.4 KiB

===============
Documentation
===============
Sparklines
==========
pygal provides a simple way to get beautiful sparklines.
.. contents::
Basic
-----
.. pygal-code:: sparkline
chart = pygal.Line()
chart.add('', [1, 3, 5, 16, 13, 3, 7])
chart.render_sparkline()
Styles
------
It supports styling like any chart but the option is given to the `render_sparkline` method:
.. pygal-code:: sparkline
from pygal.style import DarkSolarizedStyle
chart = pygal.Line()
chart.add('', [1, 3, 5, 16, 13, 3, 7])
chart.render_sparkline(style=DarkSolarizedStyle)
Options
-------
It's the same for other options:
.. pygal-code:: sparkline
chart = pygal.Line()
chart.add('', [1, 3, 5, 16, 13, 3, 7])
chart.render_sparkline(interpolate='cubic')
.. pygal-code:: sparkline
chart = pygal.Line()
chart.add('', [1, 3, 5, 16, 13, 3, 7, 9, 2, 1, 4, 9, 12, 10, 12, 16, 14, 12, 7, 2])
chart.render_sparkline(width=500, height=25, show_dots=True)
Sparktext
---------
If you want to get a simple spartext, use the render_sparktext function:
.. code-block:: python
chart = pygal.Line()
chart.add('', [1, 3, 5, 16, 13, 3, 7])
chart.render_sparktext()
 `▁▁▂█▆▁▃`
You can also specify an explicit minimum for the values:
.. code-block:: python
chart = pygal.Line()
chart.add('', [1, 3, 5, 16, 13, 3, 7])
chart.render_sparktext(relative_to=0)
 `▁▂▃█▆▂▄`
Next: `Metadata <metadata.html>`_