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.

100 lines
1.9 KiB

13 years ago
===============
Documentation
===============
Metadata
========
.. contents::
Labels
------
You can add per value metadata like labels, by specifying a dictionary instead of a value:
.. pygal-code::
chart = pygal.Bar()
chart.add('Red', [{'value': 2, 'label': 'This is red'}])
chart.add('Green', [{'value': 4, 'label': 'This is green'}])
13 years ago
chart.add('Yellow', 7)
chart.add('Blue', [{'value': 5}])
chart.add('Violet', [{'value': 3, 'label': 'This is violet'}])
13 years ago
Links
-----
Basic
12 years ago
~~~~~
13 years ago
You can also add hyper links:
.. pygal-code::
chart = pygal.Bar()
chart.add('Red', [{
13 years ago
'value': 2,
'label': 'This is red',
'xlink': 'http://en.wikipedia.org/wiki/Red'}])
13 years ago
chart.add('Green', [{
13 years ago
'value': 4,
'label': 'This is green',
'xlink': 'http://en.wikipedia.org/wiki/Green'}])
13 years ago
chart.add('Yellow', 7)
chart.add('Blue', [{
13 years ago
'value': 5,
'xlink': 'http://en.wikipedia.org/wiki/Blue'}])
13 years ago
chart.add('Violet', [{
13 years ago
'value': 3,
'label': 'This is violet',
'xlink': 'http://en.wikipedia.org/wiki/Violet_(color)'}])
13 years ago
Advanced
12 years ago
~~~~~~~~
13 years ago
You can specify a dictionary to xlink with all links attributes:
.. pygal-code::
chart = pygal.Bar()
chart.add('Red', [{
13 years ago
'value': 2,
'label': 'This is red',
'xlink': {'href': 'http://en.wikipedia.org/wiki/Red'}}])
13 years ago
chart.add('Green', [{
13 years ago
'value': 4,
'label': 'This is green',
'xlink': {
'href': 'http://en.wikipedia.org/wiki/Green',
'target': '_top'}
}])
13 years ago
chart.add('Yellow', 7)
chart.add('Blue', [{
13 years ago
'value': 5,
'xlink': {
'href': 'http://en.wikipedia.org/wiki/Blue',
'target': '_blank'}
}])
13 years ago
chart.add('Violet', [{
13 years ago
'value': 3,
'label': 'This is violet',
'xlink': {
'href': 'http://en.wikipedia.org/wiki/Violet_(color)',
'target': '_self'}
}])
13 years ago
12 years ago
Next: `Other customizations </other_customizations>`_